24 lines
605 B
TypeScript
24 lines
605 B
TypeScript
import { describe, expect, it, vi } from "vitest";
|
|
|
|
import { fetchRun } from "../src/client/api-client.js";
|
|
|
|
describe("API response validation", () => {
|
|
it("rejects a successful HTTP response with an unknown schema", async () => {
|
|
vi.stubGlobal(
|
|
"fetch",
|
|
vi.fn(() =>
|
|
Promise.resolve(
|
|
new Response(JSON.stringify({ schema_version: 2 }), {
|
|
status: 200,
|
|
headers: { "Content-Type": "application/json" },
|
|
}),
|
|
),
|
|
),
|
|
);
|
|
|
|
await expect(fetchRun()).rejects.toMatchObject({
|
|
code: "invalid_response",
|
|
});
|
|
});
|
|
});
|