diff options
| author | Erik Larkö <erik@mullvad.net> | 2017-10-13 11:31:57 +0200 |
|---|---|---|
| committer | Erik Larkö <erik@mullvad.net> | 2017-10-13 11:31:57 +0200 |
| commit | 992f7946dbe9004d88a331b97ea9e030701599ea (patch) | |
| tree | 858ef774e0751435f2b039af846cef4d29c37a0c /test/connect.spec.js | |
| parent | 8f5c5aa9a433a65d8a7f6f6d8e4211f5a82068f5 (diff) | |
| download | mullvadvpn-992f7946dbe9004d88a331b97ea9e030701599ea.tar.xz mullvadvpn-992f7946dbe9004d88a331b97ea9e030701599ea.zip | |
Move the auth flow into backend.js and write tests
Diffstat (limited to 'test/connect.spec.js')
| -rw-r--r-- | test/connect.spec.js | 30 |
1 files changed, 18 insertions, 12 deletions
diff --git a/test/connect.spec.js b/test/connect.spec.js index bb6ac41526..07e3091c6e 100644 --- a/test/connect.spec.js +++ b/test/connect.spec.js @@ -61,29 +61,35 @@ describe('connect', () => { }); }); - it('should correctly deduce \'connected\' from backend states', () => { + it('should correctly deduce \'connected\' from backend states', (done) => { const { store, mockIpc } = setupBackendAndStore(); - expect(store.getState().connection.status).not.to.equal('connected'); - mockIpc.sendNewState({ state: 'secured', target_state: 'secured' }); - expect(store.getState().connection.status).to.equal('connected'); + checkNextTick( () => { + expect(store.getState().connection.status).not.to.equal('connected'); + mockIpc.sendNewState({ state: 'secured', target_state: 'secured' }); + expect(store.getState().connection.status).to.equal('connected'); + }, done); }); - it('should correctly deduce \'connecting\' from backend states', () => { + it('should correctly deduce \'connecting\' from backend states', (done) => { const { store, mockIpc } = setupBackendAndStore(); - expect(store.getState().connection.status).not.to.equal('connecting'); - mockIpc.sendNewState({ state: 'unsecured', target_state: 'secured' }); - expect(store.getState().connection.status).to.equal('connecting'); + checkNextTick( () => { + expect(store.getState().connection.status).not.to.equal('connecting'); + mockIpc.sendNewState({ state: 'unsecured', target_state: 'secured' }); + expect(store.getState().connection.status).to.equal('connecting'); + }, done); }); - it('should correctly deduce \'disconnected\' from backend states', () => { + it('should correctly deduce \'disconnected\' from backend states', (done) => { const { store, mockIpc } = setupBackendAndStore(); store.dispatch(connectionActions.connected()); - expect(store.getState().connection.status).not.to.equal('disconnected'); - mockIpc.sendNewState({ state: 'unsecured', target_state: 'unsecured' }); - expect(store.getState().connection.status).to.equal('disconnected'); + checkNextTick( () => { + expect(store.getState().connection.status).not.to.equal('disconnected'); + mockIpc.sendNewState({ state: 'unsecured', target_state: 'unsecured' }); + expect(store.getState().connection.status).to.equal('disconnected'); + }, done); }); }); |
