summaryrefslogtreecommitdiffhomepage
path: root/test/auth.spec.js
diff options
context:
space:
mode:
authorAndrej Mihajlov <and@mullvad.net>2018-06-20 15:34:40 +0200
committerAndrej Mihajlov <and@mullvad.net>2018-07-03 13:37:54 +0200
commit73840e98952dd3f7c005fcec44c971455da179eb (patch)
tree15a887410858007a802450ad2870d8bf495dd16d /test/auth.spec.js
parent67e82627564f8e4a2d8da4bcf5f0fd00867876bc (diff)
downloadmullvadvpn-73840e98952dd3f7c005fcec44c971455da179eb.tar.xz
mullvadvpn-73840e98952dd3f7c005fcec44c971455da179eb.zip
Refactor IpcFacade to DaemonRpc and JsonRpcWs to JsonRpcTransport
Diffstat (limited to 'test/auth.spec.js')
-rw-r--r--test/auth.spec.js20
1 files changed, 12 insertions, 8 deletions
diff --git a/test/auth.spec.js b/test/auth.spec.js
index e6b2c25486..4f919dff87 100644
--- a/test/auth.spec.js
+++ b/test/auth.spec.js
@@ -8,30 +8,34 @@ describe('authentication', () => {
it('authenticates before ipc call if unauthenticated', (done) => {
const { store, mockIpc } = setupIpcAndStore();
+ const credentials = {
+ connectionString: 'ws://localhost:1234/',
+ sharedSecret: '1234',
+ };
+
const chain = new IpcChain(mockIpc);
- chain.onSuccessOrFailure(done);
chain.expect('authenticate').withInputValidation((secret) => {
expect(secret).to.equal(credentials.sharedSecret);
});
chain.expect('connect');
+ chain.end(done);
- const credentials = {
- sharedSecret: '',
- connectionString: '',
- };
- const backend = new Backend(store, credentials, mockIpc);
- backend.connect();
+ const backend = new Backend(store, mockIpc);
+ backend.connect(credentials);
+
+ backend.connectTunnel();
});
it('reauthenticates on reconnect', async () => {
const { mockIpc, backend } = setupBackendAndStore();
mockIpc.authenticate = spy(mockIpc.authenticate);
+ await mockIpc.connectTunnel();
mockIpc.killWebSocket();
expect(mockIpc.authenticate).to.not.have.been.called();
- await backend.connect();
+ await backend.connectTunnel();
expect(mockIpc.authenticate).to.have.been.called.once;
});
});