18 lines
946 B
TypeScript
18 lines
946 B
TypeScript
import { readFile } from "node:fs/promises";
|
|
import { describe, expect, it } from "vitest";
|
|
|
|
describe("billing HTTP compatibility fixture", () => {
|
|
it("freezes routes, refreshed-session scope, money, and admin mutation rules", async () => {
|
|
const fixture = JSON.parse(await readFile("contracts/billing/http-v1.json", "utf8"));
|
|
expect(fixture).toMatchObject({
|
|
version: 1, currency: "CNY", moneyUnit: "fen",
|
|
statuses: { insufficientBalance: 402, idempotencyConflict: 409, unboundOrganization: 422, infrastructure: 500 },
|
|
pricePatch: { minimum: 1, maximum: 1000, precision: 4, tierPairRequired: true }
|
|
});
|
|
expect(fixture.routes).toEqual(expect.arrayContaining([
|
|
expect.objectContaining({ method: "GET", path: "/api/billing", organizationSource: "refreshed_session" }),
|
|
expect.objectContaining({ method: "PATCH", path: "/api/admin/billing/prices/{id}", requirement: "super_admin" })
|
|
]));
|
|
});
|
|
});
|