import { expect, test } from "@playwright/test"; /** * Stage-7 closure smoke — proves that the four Stage-7 engines * (`api-graphql-yoga`, `api-graphql-apollo`, `api-ws-bun`, * `api-sse-bun`) coexist on a single Bun.serve host without route * collision, and that GraphQL federation across two plugins works * identically through both engines. */ const FED_QUERY = ` query Federated { pluginA pluginB bothA bothB } `; interface GraphqlResponse { readonly data?: Record | null; readonly errors?: ReadonlyArray<{ readonly message: string }>; } test.describe("foundation-stack-engines — Stage-7 coexistence", () => { test("1. yoga federates GraphQL across plugin-a + plugin-b", async ({ request, }) => { const res = await request.post("/graphql/yoga", { data: { query: FED_QUERY, operationName: "Federated" }, }); expect(res.status()).toBe(200); const body = (await res.json()) as GraphqlResponse; expect(body.errors).toBeUndefined(); expect(body.data).toEqual({ pluginA: "from plugin-a", pluginB: "from plugin-b", bothA: "A-half-of-both", bothB: "B-half-of-both", }); }); test("2. apollo federates the same SDL across plugin-a + plugin-b", async ({ request, }) => { const res = await request.post("/graphql/apollo", { data: { query: FED_QUERY, operationName: "Federated" }, }); expect(res.status()).toBe(200); const body = (await res.json()) as GraphqlResponse; expect(body.errors).toBeUndefined(); expect(body.data).toEqual({ pluginA: "from plugin-a", pluginB: "from plugin-b", bothA: "A-half-of-both", bothB: "B-half-of-both", }); }); });