summaryrefslogtreecommitdiffhomepage
path: root/test/auth.spec.js
diff options
context:
space:
mode:
authorAndrej Mihajlov <and@mullvad.net>2018-06-01 16:13:10 +0200
committerAndrej Mihajlov <and@mullvad.net>2018-06-05 12:11:55 +0200
commitca2f6fbfcad7b73d4ea63ef46cb1cab943ec9087 (patch)
treeb1f7754eb50896ab3681e35fa4e08be642b940c9 /test/auth.spec.js
parent5852c980980de53e00d76a0bdb4b41bf5c0f5b39 (diff)
downloadmullvadvpn-ca2f6fbfcad7b73d4ea63ef46cb1cab943ec9087.tar.xz
mullvadvpn-ca2f6fbfcad7b73d4ea63ef46cb1cab943ec9087.zip
Add formatted source code
Diffstat (limited to 'test/auth.spec.js')
-rw-r--r--test/auth.spec.js20
1 files changed, 10 insertions, 10 deletions
diff --git a/test/auth.spec.js b/test/auth.spec.js
index c3fd78c83d..effc3473cb 100644
--- a/test/auth.spec.js
+++ b/test/auth.spec.js
@@ -1,12 +1,16 @@
// @flow
import { expect } from 'chai';
-import { setupIpcAndStore, setupBackendAndStore, failFast, checkNextTick } from './helpers/ipc-helpers';
+import {
+ setupIpcAndStore,
+ setupBackendAndStore,
+ failFast,
+ checkNextTick,
+} from './helpers/ipc-helpers';
import { IpcChain } from './helpers/IpcChain';
import { Backend } from '../app/lib/backend';
describe('authentication', () => {
-
it('authenticates before ipc call if unauthenticated', (done) => {
const { store, mockIpc } = setupIpcAndStore();
const credentials = {
@@ -14,20 +18,18 @@ describe('authentication', () => {
connectionString: '',
};
-
const chain = new IpcChain(mockIpc);
- chain.require('authenticate')
- .withInputValidation( secret => {
+ chain
+ .require('authenticate')
+ .withInputValidation((secret) => {
expect(secret).to.equal(credentials.sharedSecret);
})
.done();
- chain.require('connect')
- .done();
+ chain.require('connect').done();
chain.onSuccessOrFailure(done);
-
const backend = new Backend(store, credentials, mockIpc);
backend.connect();
});
@@ -41,13 +43,11 @@ describe('authentication', () => {
return Promise.resolve();
};
-
mockIpc.killWebSocket();
failFast(() => {
expect(authCount).to.equal(0);
}, done);
-
backend.connect();
checkNextTick(() => {
expect(authCount).to.equal(1);