|
4 | 4 | watchExternalNotificationLine, |
5 | 5 | } from "@internal/dashboard-agent-contracts"; |
6 | 6 | import { ErrorId } from "@trigger.dev/core/v3/isomorphic"; |
| 7 | +import { readFileSync } from "node:fs"; |
7 | 8 | import { describe, expect, it } from "vitest"; |
8 | | -import { DEMO_MARKER } from "~/components/dashboard-agent/demo"; |
| 9 | +import { DEMO_MARKER } from "~/components/dashboard-agent/demo/ids"; |
9 | 10 | import { planDiagnosisActions } from "~/components/dashboard-agent/diagnosis-actions"; |
10 | 11 | import { renderableActions } from "~/components/dashboard-agent/view-actions"; |
11 | 12 | import { reportTrust } from "~/presenters/v3/reports/report-layout"; |
@@ -152,3 +153,22 @@ describe("gallery report", () => { |
152 | 153 | expect(trust?.badge).toBe("stale data"); |
153 | 154 | }); |
154 | 155 | }); |
| 156 | + |
| 157 | +/** |
| 158 | + * `demo/index.ts` re-exports `DemoChartCard` and `DemoIntentBubble`, so importing it here would |
| 159 | + * pull React components into a suite that runs without a DOM. `demo.test.ts` reaches past the |
| 160 | + * barrel for the same reason; these fixtures and their test do too. |
| 161 | + * |
| 162 | + * Structural: what a module drags in is not observable from inside it. |
| 163 | + */ |
| 164 | +describe("the gallery fixtures stay out of the demo barrel", () => { |
| 165 | + const BARREL = /from "~\/components\/dashboard-agent\/demo"/; |
| 166 | + |
| 167 | + for (const file of ["fixtures.ts", "fixtures.test.ts"]) { |
| 168 | + it(`${file} reaches past it`, () => { |
| 169 | + const source = readFileSync(new URL(`./${file}`, import.meta.url), "utf8"); |
| 170 | + expect(BARREL.test(source), `${file} imports the demo barrel`).toBe(false); |
| 171 | + expect(source).toContain('"~/components/dashboard-agent/demo/'); |
| 172 | + }); |
| 173 | + } |
| 174 | +}); |
0 commit comments