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