From 893a0f469a8a34119f2c014249ab61b07028bdbb Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Sat, 11 Apr 2026 12:46:49 +0100 Subject: [PATCH] test: combine web provider boundary checks --- test/web-fetch-provider-boundary.test.ts | 31 ------------ test/web-provider-boundary.test.ts | 62 +++++++++++++++++++++++ test/web-search-provider-boundary.test.ts | 44 ---------------- 3 files changed, 62 insertions(+), 75 deletions(-) delete mode 100644 test/web-fetch-provider-boundary.test.ts create mode 100644 test/web-provider-boundary.test.ts delete mode 100644 test/web-search-provider-boundary.test.ts diff --git a/test/web-fetch-provider-boundary.test.ts b/test/web-fetch-provider-boundary.test.ts deleted file mode 100644 index 295b797d6b8..00000000000 --- a/test/web-fetch-provider-boundary.test.ts +++ /dev/null @@ -1,31 +0,0 @@ -import { describe, expect, it } from "vitest"; -import { - collectWebFetchProviderBoundaryViolations, - main, -} from "../scripts/check-web-fetch-provider-boundaries.mjs"; -import { createCapturedIo } from "./helpers/captured-io.js"; - -const violationsPromise = collectWebFetchProviderBoundaryViolations(); -const jsonOutputPromise = getJsonOutput(); - -async function getJsonOutput() { - const captured = createCapturedIo(); - const exitCode = await main(["--json"], captured.io); - return { - exitCode, - stderr: captured.readStderr(), - json: JSON.parse(captured.readStdout()), - }; -} - -describe("web fetch provider boundary inventory", () => { - it("keeps Firecrawl-specific fetch logic out of core runtime/tooling", async () => { - const violations = await violationsPromise; - const jsonOutput = await jsonOutputPromise; - - expect(violations).toEqual([]); - expect(jsonOutput.exitCode).toBe(0); - expect(jsonOutput.stderr).toBe(""); - expect(jsonOutput.json).toEqual([]); - }); -}); diff --git a/test/web-provider-boundary.test.ts b/test/web-provider-boundary.test.ts new file mode 100644 index 00000000000..e466a9f4ceb --- /dev/null +++ b/test/web-provider-boundary.test.ts @@ -0,0 +1,62 @@ +import { describe, expect, it } from "vitest"; +import { + collectWebFetchProviderBoundaryViolations, + main as webFetchMain, +} from "../scripts/check-web-fetch-provider-boundaries.mjs"; +import { + collectWebSearchProviderBoundaryInventory, + main as webSearchMain, +} from "../scripts/check-web-search-provider-boundaries.mjs"; +import { BUNDLED_PLUGIN_PATH_PREFIX } from "./helpers/bundled-plugin-paths.js"; +import { createCapturedIo } from "./helpers/captured-io.js"; + +const webFetchViolationsPromise = collectWebFetchProviderBoundaryViolations(); +const webFetchJsonOutputPromise = getJsonOutput(webFetchMain); +const webSearchInventoryPromise = collectWebSearchProviderBoundaryInventory(); +const webSearchJsonOutputPromise = getJsonOutput(webSearchMain); + +async function getJsonOutput( + main: (argv: string[], io: ReturnType["io"]) => Promise, +) { + const captured = createCapturedIo(); + const exitCode = await main(["--json"], captured.io); + return { + exitCode, + stderr: captured.readStderr(), + json: JSON.parse(captured.readStdout()), + }; +} + +describe("web provider boundaries", () => { + it("keeps Firecrawl-specific fetch logic out of core runtime/tooling", async () => { + const violations = await webFetchViolationsPromise; + const jsonOutput = await webFetchJsonOutputPromise; + + expect(violations).toEqual([]); + expect(jsonOutput.exitCode).toBe(0); + expect(jsonOutput.stderr).toBe(""); + expect(jsonOutput.json).toEqual([]); + }); + + it("keeps web search provider boundary inventory empty, core-only, and sorted", async () => { + const inventory = await webSearchInventoryPromise; + const jsonOutput = await webSearchJsonOutputPromise; + + expect(inventory).toEqual([]); + expect(inventory.some((entry) => entry.file.startsWith(BUNDLED_PLUGIN_PATH_PREFIX))).toBe( + false, + ); + expect( + [...inventory].toSorted( + (left, right) => + left.provider.localeCompare(right.provider) || + left.file.localeCompare(right.file) || + left.line - right.line || + left.reason.localeCompare(right.reason), + ), + ).toEqual(inventory); + expect(jsonOutput.exitCode).toBe(0); + expect(jsonOutput.stderr).toBe(""); + expect(jsonOutput.json).toEqual([]); + }); +}); diff --git a/test/web-search-provider-boundary.test.ts b/test/web-search-provider-boundary.test.ts deleted file mode 100644 index e114dc3f83f..00000000000 --- a/test/web-search-provider-boundary.test.ts +++ /dev/null @@ -1,44 +0,0 @@ -import { describe, expect, it } from "vitest"; -import { - collectWebSearchProviderBoundaryInventory, - main, -} from "../scripts/check-web-search-provider-boundaries.mjs"; -import { BUNDLED_PLUGIN_PATH_PREFIX } from "./helpers/bundled-plugin-paths.js"; -import { createCapturedIo } from "./helpers/captured-io.js"; - -const inventoryPromise = collectWebSearchProviderBoundaryInventory(); -const jsonOutputPromise = getJsonOutput(); - -async function getJsonOutput() { - const captured = createCapturedIo(); - const exitCode = await main(["--json"], captured.io); - return { - exitCode, - stderr: captured.readStderr(), - json: JSON.parse(captured.readStdout()), - }; -} - -describe("web search provider boundary inventory", () => { - it("stays empty, core-only, and sorted", async () => { - const inventory = await inventoryPromise; - const jsonOutput = await jsonOutputPromise; - - expect(inventory).toEqual([]); - expect(inventory.some((entry) => entry.file.startsWith(BUNDLED_PLUGIN_PATH_PREFIX))).toBe( - false, - ); - expect( - [...inventory].toSorted( - (left, right) => - left.provider.localeCompare(right.provider) || - left.file.localeCompare(right.file) || - left.line - right.line || - left.reason.localeCompare(right.reason), - ), - ).toEqual(inventory); - expect(jsonOutput.exitCode).toBe(0); - expect(jsonOutput.stderr).toBe(""); - expect(jsonOutput.json).toEqual([]); - }); -});