diff options
| author | Erik Larkö <erik@mullvad.net> | 2017-07-25 09:25:51 +0200 |
|---|---|---|
| committer | Erik Larkö <erik@mullvad.net> | 2017-07-27 10:47:33 +0200 |
| commit | d88bbefcf83e1a168e1cf7849a015185c593f568 (patch) | |
| tree | 746c9d4d45f7e7e88f6a88d00775c7f7a23a17b9 /test | |
| parent | d5727bb887e87c0c2966f0765e82ca7ad50227ea (diff) | |
| download | mullvadvpn-d88bbefcf83e1a168e1cf7849a015185c593f568.tar.xz mullvadvpn-d88bbefcf83e1a168e1cf7849a015185c593f568.zip | |
Fix reducers test
Diffstat (limited to 'test')
| -rw-r--r-- | test/reducers.spec.js | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/test/reducers.spec.js b/test/reducers.spec.js index 5a0ec8f0a7..9727bb75d7 100644 --- a/test/reducers.spec.js +++ b/test/reducers.spec.js @@ -5,20 +5,22 @@ import accountReducer from '../app/redux/account/reducers'; import connectionReducer from '../app/redux/connection/reducers'; import settingsReducer from '../app/redux/settings/reducers'; import { defaultServer } from '../app/config'; +import { BackendError } from '../app/lib/backend'; describe('reducers', () => { + const previousState: any = {}; it('should handle USER_LOGIN_CHANGE', () => { const action = { type: 'USER_LOGIN_CHANGE', payload: { - account: '1111', + accountNumber: '1111', status: 'failed', - error: new Error('Something went wrong') + error: new BackendError('INVALID_ACCOUNT') } }; const test = Object.assign({}, action.payload); - expect(accountReducer({}, action)).to.deep.equal(test); + expect(accountReducer(previousState, action)).to.deep.equal(test); }); it('should handle CONNECTION_CHANGE', () => { @@ -31,7 +33,7 @@ describe('reducers', () => { } }; const test = Object.assign({}, action.payload); - expect(connectionReducer({}, action)).to.deep.equal(test); + expect(connectionReducer(previousState, action)).to.deep.equal(test); }); it('should handle SETTINGS_UPDATE', () => { @@ -43,7 +45,7 @@ describe('reducers', () => { } }; const test = Object.assign({}, action.payload); - expect(settingsReducer({}, action)).to.deep.equal(test); + expect(settingsReducer(previousState, action)).to.deep.equal(test); }); }); |
