From bc77b2464a42bd579337af757833eea338112951 Mon Sep 17 00:00:00 2001 From: unadlib Date: Thu, 9 Nov 2023 22:54:45 +0800 Subject: [PATCH] fix(test): add testing --- test/index.test.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/test/index.test.ts b/test/index.test.ts index 25d9505e..2455a74d 100644 --- a/test/index.test.ts +++ b/test/index.test.ts @@ -3359,3 +3359,15 @@ test('map: assigning a non-draft array', () => { expect(state.data.size).toBe(0); }); + +test('#20 - Filter does not work correctly when array contains objects', () => { + const baseState = { + array: [{ x: 1 }], + }; + + const state = create(baseState, (draft) => { + draft.array = draft.array.filter((o) => o.x !== 1); + }); + + expect(state.array).toEqual([]); +});