feat: add form and page platform
This commit is contained in:
@@ -106,6 +106,45 @@ describe("shared HTTP client", () => {
|
||||
});
|
||||
});
|
||||
|
||||
it("projects only approved 422 issue path and code metadata", async () => {
|
||||
server.use(
|
||||
http.post("https://api.test/api/entities", () =>
|
||||
HttpResponse.json(
|
||||
{
|
||||
success: false,
|
||||
error: {
|
||||
code: "INVALID_INPUT",
|
||||
message: "raw backend secret",
|
||||
details: {
|
||||
issues: [
|
||||
{ path: "name", code: "REQUIRED", message: "raw field copy" },
|
||||
{ path: 42, code: "INVALID" },
|
||||
],
|
||||
},
|
||||
},
|
||||
meta: { requestId: "request-422", traceId: "trace-422" },
|
||||
},
|
||||
{ status: 422 },
|
||||
),
|
||||
),
|
||||
);
|
||||
const client = testClient({ baseUrl: "https://api.test", clock });
|
||||
const result = await client.execute("CREATE_ENTITY", {
|
||||
routeId: "TEST_FORM",
|
||||
body: { name: "Valid" },
|
||||
});
|
||||
|
||||
expect(result).toMatchObject({
|
||||
ok: false,
|
||||
error: {
|
||||
kind: "VALIDATION_REJECTED",
|
||||
validationIssues: [{ path: "name", code: "REQUIRED" }],
|
||||
},
|
||||
});
|
||||
expect(JSON.stringify(result)).not.toContain("raw backend secret");
|
||||
expect(JSON.stringify(result)).not.toContain("raw field copy");
|
||||
});
|
||||
|
||||
it("guards mapper exceptions as UNKNOWN_FAILURE", async () => {
|
||||
server.use(
|
||||
http.get("https://api.test/api/entities", () =>
|
||||
|
||||
Reference in New Issue
Block a user