Files
cozsweet-frontend-nextjs/src/data/services/api/__tests__/api_path.test.ts
T
Codex 0357fbcaff
Docker Image / Build and Push Docker Image (push) Successful in 2m7s
refactor(private-zone): use canonical product name
2026-07-23 10:55:47 +08:00

25 lines
770 B
TypeScript

import { describe, expect, it } from "vitest";
import apiContract from "../api_contract.json";
import { ApiPath } from "../api_path";
describe("ApiPath contract source", () => {
it("uses the shared contract path for every static operation", () => {
const staticOperations = Object.entries(apiContract).filter(
([operationId]) => operationId !== "privateZoneAlbumUnlock",
);
for (const [operationId, operation] of staticOperations) {
expect(ApiPath[operationId as keyof typeof ApiPath]).toBe(
operation.path,
);
}
});
it("fills and encodes the private album path parameter", () => {
expect(ApiPath.privateZoneAlbumUnlock("album/id 1")).toBe(
"/api/private-zone/albums/album%2Fid%201/unlock",
);
});
});