diff options
| author | Erik Larkö <erik@mullvad.net> | 2017-07-28 11:38:41 +0200 |
|---|---|---|
| committer | Erik Larkö <erik@mullvad.net> | 2017-07-28 11:38:41 +0200 |
| commit | e13fe630fce123981e502939aafc3569a9412e0c (patch) | |
| tree | c45c1e6ae79c1702c7285820e8823a9b94b2ebca /test | |
| parent | a196629083e1fb634a1d65e816a1b4bdfbdeb072 (diff) | |
| parent | 5616dddc92d76a121d10cbbab5b6404c71ffc25b (diff) | |
| download | mullvadvpn-e13fe630fce123981e502939aafc3569a9412e0c.tar.xz mullvadvpn-e13fe630fce123981e502939aafc3569a9412e0c.zip | |
Merge branch 'login-actions'
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(() => { |
