test: tighten compaction hook assertion

This commit is contained in:
Shakker
2026-05-08 21:22:32 +01:00
parent 32ec6c2ba7
commit f49beec09a

View File

@@ -101,7 +101,11 @@ describe("compaction hook wiring", () => {
}) {
expect(params.call.event).toEqual(expect.objectContaining(params.expectedEvent));
if (params.expectedSessionKey !== undefined) {
expect(params.call.hookCtx?.sessionKey).toBe(params.expectedSessionKey);
expect(params.call.hookCtx).toBeDefined();
if (!params.call.hookCtx) {
throw new Error("Expected compaction hook context");
}
expect(params.call.hookCtx.sessionKey).toBe(params.expectedSessionKey);
}
}