Update hivegrid-cloud reference to latest main
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
e98d38e716
commit
7b21524c86
3781 files changed
+373484
-225607
No files matched your search
+36
@@ -0,0 +1,36 @@
|
||||
import { describe, expect, test } from "vitest";
|
||||
import { createPluginCapabilityUseRecorder } from "./audit.js";
|
||||
|
||||
/**
|
||||
* Coverage for the recorder's error-logging branch when the sink rejects
|
||||
* with a non-Error value — the logger receives the raw thrown value
|
||||
* rather than a {name, message} projection.
|
||||
*/
|
||||
|
||||
describe("createPluginCapabilityUseRecorder — non-Error sink failure", () => {
|
||||
test("logs the raw thrown value when the sink rejects with a non-Error", async () => {
|
||||
const errors: Record<string, unknown>[] = [];
|
||||
const recorder = createPluginCapabilityUseRecorder({
|
||||
tenantId: "t1",
|
||||
pluginId: "p1",
|
||||
sink: {
|
||||
async emit() {
|
||||
// eslint-disable-next-line @typescript-eslint/only-throw-error
|
||||
throw { code: "OUTBOX_DOWN", transient: true };
|
||||
},
|
||||
},
|
||||
logger: {
|
||||
error: (record) => {
|
||||
errors.push(record);
|
||||
},
|
||||
},
|
||||
});
|
||||
recorder.record({ capability: "log", outcome: "success" });
|
||||
|
||||
// Soft-fail (default): flush resolves, the error is only logged.
|
||||
await expect(recorder.flush()).resolves.toBeUndefined();
|
||||
expect(errors).toHaveLength(1);
|
||||
expect(errors[0]?.err).toEqual({ code: "OUTBOX_DOWN", transient: true });
|
||||
expect(errors[0]?.entryCount).toBe(1);
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user