summaryrefslogtreecommitdiffhomepage
path: root/test
diff options
context:
space:
mode:
authorErik Larkö <erik@mullvad.net>2017-09-13 14:26:57 +0200
committerErik Larkö <erik@mullvad.net>2017-09-13 14:26:57 +0200
commit754af96a12716152f2ddb9e56836e29f28720614 (patch)
tree27d9663ea988ef8c779ec8a9646e37d87381dc1e /test
parent057f46bc30102b48b54775c4f43288c87e8203bb (diff)
parentdf25856fe28e3568e1a9fd2584c59ab8a2808ddd (diff)
downloadmullvadvpn-754af96a12716152f2ddb9e56836e29f28720614.tar.xz
mullvadvpn-754af96a12716152f2ddb9e56836e29f28720614.zip
Merge branch 'set_custom_relay'
Diffstat (limited to 'test')
-rw-r--r--test/components/Connect.spec.js2
-rw-r--r--test/connect.spec.js27
-rw-r--r--test/mocks/ipc.js2
3 files changed, 21 insertions, 10 deletions
diff --git a/test/components/Connect.spec.js b/test/components/Connect.spec.js
index 2a385fed5f..30228fc4c6 100644
--- a/test/components/Connect.spec.js
+++ b/test/components/Connect.spec.js
@@ -94,7 +94,7 @@ describe('components/Connect', () => {
it('invokes the onConnect prop', (done) => {
const component = renderNotConnected({
- onConnect: done,
+ onConnect: () => done(),
});
const connectButton = component.find('.button .button--positive');
diff --git a/test/connect.spec.js b/test/connect.spec.js
index 9ecedb53a1..bb6ac41526 100644
--- a/test/connect.spec.js
+++ b/test/connect.spec.js
@@ -7,13 +7,15 @@ import { IpcChain } from './helpers/IpcChain';
describe('connect', () => {
- it('should invoke set_country and then connect in the backend', (done) => {
+ it('should invoke set_custom_relay and then connect in the backend', (done) => {
const { store, mockIpc, backend } = setupBackendAndStore();
const chain = new IpcChain(mockIpc);
- chain.require('setCountry')
+ chain.require('setCustomRelay')
.withInputValidation(
- (country) => expect(country).to.equal('example.com')
+ (relayEndpoint) => {
+ expect(relayEndpoint).to.equal(arbitraryRelay);
+ },
)
.done();
@@ -22,7 +24,7 @@ describe('connect', () => {
chain.onSuccessOrFailure(done);
- store.dispatch(connectionActions.connect(backend, 'example.com'));
+ store.dispatch(connectionActions.connect(backend, arbitraryRelay));
});
it('should set the connection state to \'disconnected\' on failed attempts', (done) => {
@@ -35,7 +37,7 @@ describe('connect', () => {
expect(store.getState().connection.status).not.to.equal('disconnected');
- store.dispatch(connectionActions.connect(backend, 'example.com'));
+ store.dispatch(connectionActions.connect(backend, arbitraryRelay));
checkNextTick(() => {
@@ -45,13 +47,17 @@ describe('connect', () => {
it('should update the state with the server address', () => {
const { store, backend } = setupBackendAndStore();
- const arbitraryString = 'www.example.com';
+ const relay = {
+ host: 'www.example.com',
+ port: 1,
+ protocol: 'udp',
+ };
- return backend.connect(arbitraryString)
+ return backend.connect(relay)
.then( () => {
const state = store.getState().connection;
expect(state.status).to.equal('connecting');
- expect(state.serverAddress).to.equal(arbitraryString);
+ expect(state.serverAddress).to.equal('www.example.com');
});
});
@@ -81,3 +87,8 @@ describe('connect', () => {
});
});
+const arbitraryRelay = {
+ host: 'www.example.com',
+ port: 1,
+ protocol: 'udp',
+};
diff --git a/test/mocks/ipc.js b/test/mocks/ipc.js
index d28c49e6f6..472811ef4c 100644
--- a/test/mocks/ipc.js
+++ b/test/mocks/ipc.js
@@ -27,7 +27,7 @@ export function newMockIpc() {
setAccount: () => {
return new Promise(r => r());
},
- setCountry: () => {
+ setCustomRelay: () => {
return new Promise(r => r());
},
connect: () => {