Skip to content

Where people and agents ship software together. The open-source git platform for the whole job: issues, agents, checks and deploys to the edge.

g1t.sh
72 linesCodeBlameRaw
1import assert from "node:assert/strict";
2import { test } from "node:test";
3
4import { CONNECTOR_CATEGORIES, CONNECTORS, connectorPath, connectorView, connectorsFor } from "./connectors.ts";
5import { AI_PROVIDERS } from "./ai.ts";
6import { PROVIDERS } from "./integrations.ts";
7
8test("every connector has a unique id, a category and a scope", () => {
9 const ids = new Set<string>();
10 const categories = new Set(CONNECTOR_CATEGORIES.map((category) => category.id));
11 for (const connector of CONNECTORS) {
12 assert.ok(!ids.has(connector.id), `${connector.id} is listed twice`);
13 ids.add(connector.id);
14 assert.match(connector.id, /^[a-z0-9-]+$/, connector.id);
15 assert.ok(categories.has(connector.category), connector.id);
16 assert.ok(connector.scopes.length > 0, connector.id);
17 assert.ok(connector.description.length > 0 && !connector.description.includes("\n"), connector.id);
18 }
19});
20
21test("every category has connectors, and an available one in each scope it has is set up somewhere", () => {
22 for (const category of CONNECTOR_CATEGORIES) {
23 assert.ok(CONNECTORS.some((connector) => connector.category === category.id), category.id);
24 }
25 for (const scope of ["workspace", "personal"] as const) {
26 for (const view of connectorsFor(scope)) {
27 if (view.status === "available") assert.ok(view.href?.startsWith("/"), `${view.id} (${scope}) has nowhere to set it up`);
28 else assert.equal(view.href, null, view.id);
29 }
30 }
31});
32
33test("every integration provider is an available connector, and no AI provider is one", () => {
34 for (const provider of Object.keys(PROVIDERS)) {
35 const connector = CONNECTORS.find((c) => c.provider === provider);
36 assert.ok(connector, `${provider} has no connector`);
37 assert.equal(connector.status, "available", provider);
38 }
39 // AI providers are each workspace's AI settings, at -/ai, not integrations.
40 for (const provider of Object.keys(AI_PROVIDERS)) {
41 assert.equal(CONNECTORS.find((c) => (c.provider as string) === provider || c.id === provider.replace(/_/g, "-")), undefined, provider);
42 }
43});
44
45test("only what g1t sets up end to end is available; the docs' Available today lists the same", () => {
46 const available = (scope: "workspace" | "personal") =>
47 connectorsFor(scope)
48 .filter((view) => view.status === "available")
49 .map((view) => view.id)
50 .sort();
51 assert.deepEqual(available("workspace"), ["alerts-webhook", "datadog", "github", "jira", "linear", "sentry", "webhooks"]);
52 assert.deepEqual(available("personal"), ["github", "mcp"]);
53});
54
55test("a connector shows its personal side to you", () => {
56 const github = CONNECTORS.find((c) => c.id === "github")!;
57 const mine = connectorView(github, "personal")!;
58 assert.equal(mine.href, "/settings/github");
59 assert.ok(mine.capabilities.includes("Signs you in"));
60 assert.equal(mine.alsoIn, "workspace");
61 const linear = CONNECTORS.find((c) => c.id === "linear")!;
62 assert.equal(connectorView(linear, "workspace")!.status, "available");
63 assert.equal(connectorView(linear, "personal")!.status, "soon");
64 assert.equal(connectorView(linear, "personal")!.href, null);
65 const calendar = CONNECTORS.find((c) => c.id === "google-calendar")!;
66 assert.equal(connectorView(calendar, "workspace"), null);
67});
68
69test("a setup path names the workspace", () => {
70 assert.equal(connectorPath("/:workspace/-/integrations/alerts?add=sentry#add", "acme"), "/acme/-/integrations/alerts?add=sentry#add");
71 assert.equal(connectorPath("/new/github?workspace=:workspace", "acme"), "/new/github?workspace=acme");
72});