diff options
| author | Erik Larkö <erik@mullvad.net> | 2017-07-25 14:02:33 +0200 |
|---|---|---|
| committer | Erik Larkö <erik@mullvad.net> | 2017-07-28 11:25:16 +0200 |
| commit | e2bf350e0742724f86a131c7421fea50c839f378 (patch) | |
| tree | 983f2f903afb67298f0c5e6a1ec1fe69264879eb /test | |
| parent | a196629083e1fb634a1d65e816a1b4bdfbdeb072 (diff) | |
| download | mullvadvpn-e2bf350e0742724f86a131c7421fea50c839f378.tar.xz mullvadvpn-e2bf350e0742724f86a131c7421fea50c839f378.zip | |
Added START_LOGIN action
Diffstat (limited to 'test')
| -rw-r--r-- | test/login.spec.js | 29 |
1 files changed, 11 insertions, 18 deletions
diff --git a/test/login.spec.js b/test/login.spec.js index 950205804c..5c7e0fe540 100644 --- a/test/login.spec.js +++ b/test/login.spec.js @@ -25,25 +25,22 @@ describe('Logging in', () => { chain.onSuccessOrFailure(done); - const action: any = accountActions.login(backend, '123'); - store.dispatch(action); + store.dispatch(accountActions.login(backend, '123')); }); - it('should put the account data in the state', (done) => { + it('should put the account data in the state', () => { const { store, backend, mockIpc } = setupBackendAndStore(); mockIpc.getAccountData = () => new Promise(r => r({ paid_until: '2001-01-01T00:00:00', })); - const action: any = accountActions.login(backend, '123'); - store.dispatch(action); - - checkNextTick( () => { - const state = store.getState().account; - expect(state.status).to.equal('ok'); - expect(state.accountNumber).to.equal('123'); - expect(state.paidUntil).to.equal('2001-01-01T00:00:00'); - }, done); + return backend.login('123') + .then( () => { + const state = store.getState().account; + expect(state.status).to.equal('ok'); + expect(state.accountNumber).to.equal('123'); + expect(state.paidUntil).to.equal('2001-01-01T00:00:00'); + }); }); it('should indicate failure for non-existing accounts', (done) => { @@ -54,9 +51,7 @@ describe('Logging in', () => { }); - const action: any = accountActions.login(backend, '123'); - store.dispatch(action); - + store.dispatch(accountActions.login(backend, '123')); checkNextTick(() => { const state = store.getState().account; @@ -68,9 +63,7 @@ describe('Logging in', () => { it('should redirect to /connect after 1s after successful login', (done) => { const { store, backend } = setupBackendAndMockStore(); - const action: any = accountActions.login(backend, '123'); - store.dispatch(action); - + store.dispatch(accountActions.login(backend, '123')); setTimeout(() => { |
