From 7f0cde8d16dcee36b588c103b3c9bcddbab9a535 Mon Sep 17 00:00:00 2001 From: Shakker Date: Fri, 8 May 2026 18:05:15 +0100 Subject: [PATCH] test: tighten commitment batch privacy assertions --- src/commitments/runtime.test.ts | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/src/commitments/runtime.test.ts b/src/commitments/runtime.test.ts index d82f178f27b..0c5b66aa21a 100644 --- a/src/commitments/runtime.test.ts +++ b/src/commitments/runtime.test.ts @@ -145,12 +145,20 @@ describe("commitment extraction runtime", () => { const store = await loadCommitmentStore(); expect(extractBatch).toHaveBeenCalledTimes(1); - const batchItems = extractBatch.mock.calls[0]?.[0].items; + const [extractCall] = extractBatch.mock.calls; + if (!extractCall) { + throw new Error("Expected commitment extraction batch call"); + } + const batchItems = extractCall[0].items; expect(batchItems).toHaveLength(2); - expect(batchItems?.[0]?.itemId).not.toContain("main"); - expect(batchItems?.[0]?.itemId).not.toContain("telegram"); - expect(batchItems?.[0]?.itemId).not.toContain("15551234567"); - expect(batchItems?.[0]?.itemId).not.toContain("m1"); + const [firstBatchItem] = batchItems; + if (!firstBatchItem) { + throw new Error("Expected first commitment extraction batch item"); + } + expect(firstBatchItem.itemId).not.toContain("main"); + expect(firstBatchItem.itemId).not.toContain("telegram"); + expect(firstBatchItem.itemId).not.toContain("15551234567"); + expect(firstBatchItem.itemId).not.toContain("m1"); expect(store.commitments.map((commitment) => commitment.dedupeKey)).toEqual([ "event:1", "event:2",