From d5bf960018941f8767419f9328db74f28d3c00e6 Mon Sep 17 00:00:00 2001 From: Ejirosoft Date: Sat, 27 Jun 2026 19:46:41 +0000 Subject: [PATCH] test: cover verifier batchApprove/batchReject duplicate and all-unknown id edge cases --- src/Zustand/__tests__/Store.test.ts | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/Zustand/__tests__/Store.test.ts b/src/Zustand/__tests__/Store.test.ts index 2122a58..58e131b 100644 --- a/src/Zustand/__tests__/Store.test.ts +++ b/src/Zustand/__tests__/Store.test.ts @@ -57,6 +57,24 @@ describe('verifier store — batch mutators', () => { expect(validationHistory).toHaveLength(0); }); + it('processes a duplicated id only once without throwing', () => { + useVerifierStore.getState().batchApprove(['a', 'a'], 'dupe'); + + const { pendingValidations, validationHistory } = useVerifierStore.getState(); + expect(pendingValidations.map((t) => t.id)).toEqual(['b', 'c']); + expect(validationHistory.map((t) => t.id)).toEqual(['a']); + expect(validationHistory[0].status).toBe('approved'); + }); + + it('treats an all-unknown id list as a no-op', () => { + useVerifierStore.getState().batchApprove(['x', 'y']); + useVerifierStore.getState().batchReject(['z']); + + const { pendingValidations, validationHistory } = useVerifierStore.getState(); + expect(pendingValidations.map((t) => t.id)).toEqual(['a', 'b', 'c']); + expect(validationHistory).toHaveLength(0); + }); + it('approves all tasks and leaves the queue empty', () => { useVerifierStore.getState().batchApprove(['a', 'b', 'c']);