fix(housekeeping): preserve pathological operation errors
This commit is contained in:
1 parent
b5957015e7
commit
86a2d9d069
2 files changed
+24
-4
No files matched your search
@@ -141,4 +141,24 @@ describe("audit command envelope", () => {
|
||||
runWithAuditIntent(writer, auditEntry, () => Promise.reject(original)),
|
||||
).rejects.toBe(original);
|
||||
});
|
||||
it("preserves a pathological rejection when failure evidence rejects", async () => {
|
||||
const { proxy, revoke } = Proxy.revocable(
|
||||
new Error("operation failed"),
|
||||
{},
|
||||
);
|
||||
revoke();
|
||||
const writer: HousekeepingAuditWriter = {
|
||||
write: vi
|
||||
.fn()
|
||||
.mockResolvedValueOnce(undefined)
|
||||
.mockRejectedValueOnce(new Error("audit failure")),
|
||||
};
|
||||
let rejected: unknown;
|
||||
try {
|
||||
await runWithAuditIntent(writer, auditEntry, () => Promise.reject(proxy));
|
||||
} catch (error) {
|
||||
rejected = error;
|
||||
}
|
||||
expect(rejected === proxy).toBe(true);
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user