feat: complete TASK-WP0-03 browser gate

This commit is contained in:
suyx
2026-07-27 18:23:20 +08:00
parent dbe3e73b91
commit 878788b1e2
25 changed files with 3227 additions and 21 deletions
+12 -6
View File
@@ -14,11 +14,14 @@ afterAll(async () => {
const evidenceDirectory = process.env.DADA_EVIDENCE_DIR_API;
if (!evidenceDirectory) return;
const app = await createApp();
const app = await createApp({ browserGate: false });
await app.ready();
const document = app.swagger();
const response = await app.inject({
headers: { "x-correlation-id": "018f6d52-3348-7a3a-a741-7f65f31f9218" },
headers: {
host: "127.0.0.1:43121",
"x-correlation-id": "018f6d52-3348-7a3a-a741-7f65f31f9218",
},
method: "GET",
url: "/api/v1/bootstrap",
});
@@ -52,7 +55,7 @@ afterAll(async () => {
describe("TDD-WP0-API-001 schema envelope", () => {
it("generates the committed OpenAPI 3.1 snapshot from runtime schemas", async () => {
const app = await createApp();
const app = await createApp({ browserGate: false });
await app.ready();
const document = app.swagger();
@@ -79,16 +82,19 @@ describe("TDD-WP0-API-001 schema envelope", () => {
});
it("echoes a valid correlation UUID and replaces an invalid one", async () => {
const app = await createApp();
const app = await createApp({ browserGate: false });
await app.ready();
const accepted = await app.inject({
headers: { "x-correlation-id": "018f6d52-3348-7a3a-a741-7f65f31f9218" },
headers: {
host: "127.0.0.1:43121",
"x-correlation-id": "018f6d52-3348-7a3a-a741-7f65f31f9218",
},
method: "GET",
url: "/api/v1/bootstrap",
});
const replaced = await app.inject({
headers: { "x-correlation-id": "not-a-uuid" },
headers: { host: "127.0.0.1:43121", "x-correlation-id": "not-a-uuid" },
method: "GET",
url: "/api/v1/bootstrap",
});