From 3b1e5b9ff06e673020d596c899754586c5057890 Mon Sep 17 00:00:00 2001 From: Linus Miller Date: Sun, 1 Dec 2019 19:37:38 +0100 Subject: [PATCH] Update tests to handle update argument in listeners --- test/unistore.test.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/test/unistore.test.js b/test/unistore.test.js index 7bc3a40..35214f0 100644 --- a/test/unistore.test.js +++ b/test/unistore.test.js @@ -36,15 +36,17 @@ describe('createStore()', () => { let rval = store.subscribe(sub1); expect(rval).toBeInstanceOf(Function); - store.setState({ a: 'b' }); - expect(sub1).toBeCalledWith(store.getState(), action); + let update1 = { a: 'b' }; + store.setState(update1); + expect(sub1).toBeCalledWith(store.getState(), action, update1); store.subscribe(sub2); - store.setState({ c: 'd' }); + let update2 = { c: 'd' }; + store.setState(update2); expect(sub1).toHaveBeenCalledTimes(2); - expect(sub1).toHaveBeenLastCalledWith(store.getState(), action); - expect(sub2).toBeCalledWith(store.getState(), action); + expect(sub1).toHaveBeenLastCalledWith(store.getState(), action, update2); + expect(sub2).toBeCalledWith(store.getState(), action, update2); }); it('should unsubscribe', () => {