Files
hanzo.ai/e2e/gates/integrations.spec.ts
zeekay 6c65e3e941 @hanzo/app 0.2.0: the app SDK, renamed from @hanzo/rooms
Every import, the catalog pin and the docs name @hanzo/app and
github.com/hanzoai/app. lib/rooms.ts is lib/app.ts and
components/rooms.tsx is components/app.tsx.
2026-10-22 19:07:20 -07:00

52 lines
2.2 KiB
TypeScript

import { test, expect } from '@playwright/test'
import { readdirSync } from 'node:fs'
import { join } from 'node:path'
import { OUT, serveExport } from './export'
/**
* Every connector the catalog carries is on the page that lists them.
*
* `links.spec` holds the other direction — no rendered link points at an address
* the export cannot serve — and it cannot catch this one. A connector in
* `@hanzo/app/lib/integrations` that no card renders leaves nothing dangling: no card,
* no link, no 404, so a connector dropped from /integrations while it is still
* in the data reads green through every gate that walks rendered links.
*
* The catalog is read as the per-connector pages under `out/integrations/`,
* which Next `generateStaticParams`'d from `@hanzo/app/lib/integrations` — so the set of
* slug pages IS the catalog, and reading it off the export rather than importing
* the module keeps this test free of that module's model-count dependency, which
* pulls a JSON import this loader rejects. Same reason `links.spec` reads the
* export with `fs` instead of importing the data.
*/
const slugs = readdirSync(join(OUT, 'integrations'))
.filter((f) => f.endsWith('.html'))
.map((f) => f.replace(/\.html$/, ''))
test.describe('the connectors page lists every connector', () => {
let base: string
let stop: () => Promise<void>
test.beforeAll(async () => {
const served = await serveExport()
base = served.url
stop = served.close
})
test.afterAll(async () => stop())
test('/integrations renders a link to each connector the export ships', async ({ page }) => {
// The catalog is not empty, so a listing that rendered zero cards would fail
// the comparison below rather than pass it vacuously.
expect(slugs.length).toBeGreaterThan(0)
await page.goto(`${base}/integrations`)
const hrefs = new Set(
await page
.locator('a[href^="/integrations/"]')
.evaluateAll((as) => as.map((a) => (a as HTMLAnchorElement).getAttribute('href'))),
)
const missing = slugs.filter((slug) => !hrefs.has(`/integrations/${slug}`))
expect(missing, 'connectors shipped as pages but with no card on /integrations').toEqual([])
})
})