From 35cabbe985e4be90120f3bdf6d236083a610c215 Mon Sep 17 00:00:00 2001 From: Josh Johnson Date: Thu, 28 Nov 2019 21:20:36 +0000 Subject: [PATCH] Add tests for clearItems --- src/scripts/choices.test.js | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/src/scripts/choices.test.js b/src/scripts/choices.test.js index 207e9a3..73c75b4 100644 --- a/src/scripts/choices.test.js +++ b/src/scripts/choices.test.js @@ -1055,6 +1055,31 @@ describe('choices', () => { }); }); + describe('clearItems', () => { + let storeDispatchStub; + + beforeEach(() => { + storeDispatchStub = stub(); + instance._store.dispatch = storeDispatchStub; + + output = instance.clearItems(); + }); + + afterEach(() => { + instance._store.dispatch.reset(); + }); + + it('returns this', () => { + expect(output).to.eql(instance); + }); + + it('dispatches clearItems action', () => { + expect(storeDispatchStub.lastCall.args[0]).to.eql({ + type: ACTION_TYPES.CLEAR_ITEMS, + }); + }); + }); + describe('clearStore', () => { let storeDispatchStub;