fix(housekeeping): address task 14 review round 3
This commit is contained in:
1 parent
c524b305d7
commit
d1160eb65a
7 files changed
+243
-40
No files matched your search
@@ -122,31 +122,68 @@ describe("Content production mutation adapter", () => {
|
||||
expect(JSON.stringify(deps.writeAudit.mock.calls)).not.toContain("Hello");
|
||||
});
|
||||
|
||||
it("routes a logo write through correlated intent and outcome audit", async () => {
|
||||
const deps = dependencies();
|
||||
await deps.adapter.execute(
|
||||
"logo.save",
|
||||
{ file: { name: "logo.png" } },
|
||||
mutationContext,
|
||||
);
|
||||
expect(deps.executeOperation).toHaveBeenCalledWith(
|
||||
"logo.save",
|
||||
expect.anything(),
|
||||
mutationContext,
|
||||
);
|
||||
expect(deps.writeAudit.mock.calls.map(([entry]) => entry)).toEqual([
|
||||
expect.objectContaining({
|
||||
action: "content.logo.save",
|
||||
outcome: "intent",
|
||||
correlationId: "production-matrix",
|
||||
}),
|
||||
expect.objectContaining({
|
||||
action: "content.logo.save",
|
||||
outcome: "success",
|
||||
correlationId: "production-matrix",
|
||||
}),
|
||||
]);
|
||||
});
|
||||
it.each(["favicon.save", "logo.save"] as const)(
|
||||
"routes %s through correlated intent and outcome audit",
|
||||
async (operation) => {
|
||||
const deps = dependencies();
|
||||
await deps.adapter.execute(
|
||||
operation,
|
||||
{ file: { name: "brand.png" } },
|
||||
mutationContext,
|
||||
);
|
||||
expect(deps.executeOperation).toHaveBeenCalledWith(
|
||||
operation,
|
||||
expect.anything(),
|
||||
mutationContext,
|
||||
);
|
||||
expect(deps.writeAudit.mock.calls.map(([entry]) => entry)).toEqual([
|
||||
expect.objectContaining({
|
||||
action: `content.${operation}`,
|
||||
outcome: "intent",
|
||||
correlationId: "production-matrix",
|
||||
}),
|
||||
expect.objectContaining({
|
||||
action: `content.${operation}`,
|
||||
outcome: "success",
|
||||
correlationId: "production-matrix",
|
||||
}),
|
||||
]);
|
||||
},
|
||||
);
|
||||
|
||||
it.each(["favicon.save", "logo.save"] as const)(
|
||||
"returns a typed partial for %s when its outcome audit is unavailable",
|
||||
async (operation) => {
|
||||
const deps = dependencies();
|
||||
deps.writeAudit
|
||||
.mockResolvedValueOnce(undefined)
|
||||
.mockRejectedValueOnce(new Error("audit offline"));
|
||||
const snapshot = await deps.adapter.execute(
|
||||
operation,
|
||||
{ file: { name: "brand.png" } },
|
||||
mutationContext,
|
||||
);
|
||||
expect(snapshot.completion).toEqual({
|
||||
status: "partial",
|
||||
external: "completed",
|
||||
audit: "unavailable",
|
||||
});
|
||||
expect(deps.writeAudit.mock.calls).toEqual([
|
||||
[
|
||||
expect.objectContaining({
|
||||
action: `content.${operation}`,
|
||||
outcome: "intent",
|
||||
}),
|
||||
],
|
||||
[
|
||||
expect.objectContaining({
|
||||
action: `content.${operation}`,
|
||||
outcome: "success",
|
||||
}),
|
||||
],
|
||||
]);
|
||||
},
|
||||
);
|
||||
|
||||
it("returns typed partial when database committed but the external effect failed", async () => {
|
||||
const deps = dependencies();
|
||||
|
||||
Reference in new issue
Block a user