test: establish frontend gate taxonomy
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
import { HttpResponse, http } from "msw";
|
||||
import { setupServer } from "msw/node";
|
||||
import { afterAll, afterEach, beforeAll, describe, expect, it } from "vitest";
|
||||
|
||||
const server = setupServer(
|
||||
http.get("https://example.test/health", () =>
|
||||
HttpResponse.json({ success: true, data: { status: "ok" } }),
|
||||
),
|
||||
);
|
||||
|
||||
beforeAll(() => server.listen({ onUnhandledRequest: "error" }));
|
||||
afterEach(() => server.resetHandlers());
|
||||
afterAll(() => server.close());
|
||||
|
||||
describe("integration test level", () => {
|
||||
it("uses MSW to isolate the HTTP boundary", async () => {
|
||||
const response = await fetch("https://example.test/health");
|
||||
await expect(response.json()).resolves.toEqual({
|
||||
success: true,
|
||||
data: { status: "ok" },
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user