From d0158e0553bfb40deef5d51e2919dae0475ee3f8 Mon Sep 17 00:00:00 2001 From: Andrew Duthie Date: Thu, 8 Jun 2017 16:43:14 -0400 Subject: [PATCH] Guard against unhandled action reference change --- editor/test/state.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/editor/test/state.js b/editor/test/state.js index 48c2d41bb4e45..5eba77e985b40 100644 --- a/editor/test/state.js +++ b/editor/test/state.js @@ -981,6 +981,18 @@ describe( 'state', () => { expect( store.getState ).to.be.a( 'function' ); } ); + it( 'should return same state on unhandled action', () => { + // If you're here investigating why tests are failing, you should + // ensure that your reducer is not returning a new state object if + // it's not handling the action (i.e. that nothing has changed) + const store = createReduxStore(); + const originalState = store.getState(); + + store.dispatch( { type: '__UNHANDLED' } ); + + expect( store.getState() ).to.equal( originalState ); + } ); + it( 'should have expected reducer keys', () => { const store = createReduxStore(); const state = store.getState();