63 lines
1.9 KiB
TypeScript
63 lines
1.9 KiB
TypeScript
import { describe, expect, it } from "vitest";
|
|
|
|
import { createTechLogServingContract } from "../../scripts/lib/tech-log-serving-contract.ts";
|
|
import {
|
|
projects,
|
|
publicRecords,
|
|
releases,
|
|
} from "../../src/features/tech-log/adapters/static/public-content.ts";
|
|
|
|
describe("TechLog production serving contract", () => {
|
|
it("derives every known Public path from the installed static content", () => {
|
|
const contract = createTechLogServingContract({
|
|
projects,
|
|
publicRecords,
|
|
releases,
|
|
});
|
|
|
|
expect(contract.publicSpaPaths).toEqual([
|
|
"/",
|
|
"/cases/collection-fetch-join-pagination",
|
|
"/cases/redis-adapter-ttl-boundary",
|
|
"/explore",
|
|
"/explore/cases",
|
|
"/explore/questions",
|
|
"/explore/references",
|
|
"/profile",
|
|
"/projects",
|
|
"/projects/auth-lab",
|
|
"/projects/auth-lab/activity",
|
|
"/projects/auth-lab/decisions",
|
|
"/projects/auth-lab/records",
|
|
"/projects/backend-skeleton",
|
|
"/projects/backend-skeleton/activity",
|
|
"/projects/backend-skeleton/decisions",
|
|
"/projects/backend-skeleton/records",
|
|
"/questions/collection-fetch-join-with-pagination",
|
|
"/questions/validate-edge-token-again",
|
|
"/references/jpa-list-fetch-strategy",
|
|
"/references/state-and-nonce-boundary",
|
|
"/releases",
|
|
"/releases/0.1.0",
|
|
"/search",
|
|
"/topics/authentication",
|
|
"/topics/jpa",
|
|
"/topics/redis",
|
|
]);
|
|
expect(contract.studioPathPrefix).toBe("/studio");
|
|
expect(contract.studioSpaPathPatterns).toEqual([
|
|
"^/studio$",
|
|
"^/studio/documents$",
|
|
"^/studio/documents/new$",
|
|
"^/studio/documents/[^/]+/(edit|validation|preview|publish)$",
|
|
"^/studio/publications$",
|
|
"^/studio/publications/[^/]+/preview$",
|
|
]);
|
|
expect(contract.notFound).toEqual({
|
|
status: 404,
|
|
contentType: "text/plain;charset=UTF-8",
|
|
body: "Not Found",
|
|
});
|
|
});
|
|
});
|