Pre-launch — Gluecron is in final validation. Public signups and git hosting for non-owner users open after launch review.
CodeIssuesDiscussionsWikiPull RequestsProjectsCommitsActionsReleasesContributorsPulse● GatesSecuritySettingsDeploymentsPipelineInsightsAgents✨ Explain✨ Ask AI✨ Workspace✨ Spec✨ Tests▓ Debt Map✨ NL Search🏛 Archaeology
Blame · Line-by-line history

vscode-extension.test.ts

Each line is annotated with the commit that last touched it. Click any SHA to jump to that commit and see the surrounding change.

vscode-extension.test.tsBlame71 lines · 1 contributor
eae38d1Claude1/**
2 * Block G4 — VS Code extension pure-helper tests.
3 *
4 * The extension itself depends on the `vscode` module (only available inside
5 * the host), but the URL-building helpers are pure — we re-implement them
6 * locally here to lock the contract. If the contract drifts in extension.ts,
7 * update this file in lockstep.
8 */
9
10import { describe, it, expect } from "bun:test";
11import { readFileSync } from "node:fs";
12import { join } from "node:path";
13
14// Mirror of src/extension.ts — keep in sync.
15function buildWebUrl(
16 host: string,
17 owner: string,
18 repo: string,
19 relPath: string,
20 line?: number
21): string {
22 const base = `${host.replace(/\/+$/, "")}/${owner}/${repo}/blob/main/${relPath}`;
23 return line ? `${base}#L${line + 1}` : base;
24}
25
26describe("vscode-extension — buildWebUrl", () => {
27 it("builds a basic web URL", () => {
28 expect(buildWebUrl("https://gluecron.com", "alice", "proj", "README.md")).toBe(
29 "https://gluecron.com/alice/proj/blob/main/README.md"
30 );
31 });
32
33 it("appends #L<n+1> when a line is supplied", () => {
34 expect(
35 buildWebUrl("https://gluecron.com", "alice", "proj", "src/x.ts", 41)
36 ).toBe("https://gluecron.com/alice/proj/blob/main/src/x.ts#L42");
37 });
38
39 it("strips trailing slashes from the host", () => {
40 expect(buildWebUrl("https://g.com///", "a", "b", "c")).toBe(
41 "https://g.com/a/b/blob/main/c"
42 );
43 });
44});
45
46describe("vscode-extension — package.json contract", () => {
47 const pkg = JSON.parse(
48 readFileSync(
49 join(process.cwd(), "vscode-extension/package.json"),
50 "utf8"
51 )
52 );
53
54 it("declares the expected commands", () => {
55 const names = pkg.contributes.commands.map((c: any) => c.command);
56 expect(names).toContain("gluecron.explainFile");
57 expect(names).toContain("gluecron.openOnWeb");
58 expect(names).toContain("gluecron.searchSemantic");
59 expect(names).toContain("gluecron.generateTests");
60 });
61
62 it("declares configuration keys host + token", () => {
63 const keys = Object.keys(pkg.contributes.configuration.properties);
64 expect(keys).toContain("gluecron.host");
65 expect(keys).toContain("gluecron.token");
66 });
67
68 it("activates onStartupFinished", () => {
69 expect(pkg.activationEvents).toContain("onStartupFinished");
70 });
71});