summaryrefslogtreecommitdiffhomepage
path: root/test
diff options
context:
space:
mode:
authorLinus Färnstrand <linus@mullvad.net>2017-11-23 14:17:08 +0100
committerLinus Färnstrand <linus@mullvad.net>2017-11-23 14:17:08 +0100
commit3e658480c3e1d33162f36ef98925a3562e4c8816 (patch)
treeeb9020de516e9fff8c42b09d37656843dfd64eda /test
parent3b5ae5b7c7943fd83ee8c4b7dac3e13113f70e92 (diff)
parent1b329c2d91652631a673a5c3f1dd4b6ad7a10ef1 (diff)
downloadmullvadvpn-3e658480c3e1d33162f36ef98925a3562e4c8816.tar.xz
mullvadvpn-3e658480c3e1d33162f36ef98925a3562e4c8816.zip
Merge branch 'adapt-to-changed-backend-api'
Diffstat (limited to 'test')
-rw-r--r--test/auth.spec.js4
-rw-r--r--test/components/Connect.spec.js10
-rw-r--r--test/components/SelectLocation.spec.js8
-rw-r--r--test/components/Settings.spec.js8
-rw-r--r--test/connect.spec.js8
-rw-r--r--test/mocks/ipc.js24
6 files changed, 35 insertions, 27 deletions
diff --git a/test/auth.spec.js b/test/auth.spec.js
index fa500bd8e3..1725038acd 100644
--- a/test/auth.spec.js
+++ b/test/auth.spec.js
@@ -29,7 +29,7 @@ describe('authentication', () => {
const backend = new Backend(store, credentials, mockIpc);
- backend.connect('example.com');
+ backend.connect('example.com', 'udp', 1301);
});
it('reauthenticates on reconnect', (done) => {
@@ -48,7 +48,7 @@ describe('authentication', () => {
}, done);
- backend.connect('example.com');
+ backend.connect('example.com', 'udp', 1301);
checkNextTick(() => {
expect(authCount).to.equal(1);
}, done);
diff --git a/test/components/Connect.spec.js b/test/components/Connect.spec.js
index 4b84b3b8da..d672aa77d6 100644
--- a/test/components/Connect.spec.js
+++ b/test/components/Connect.spec.js
@@ -107,8 +107,10 @@ describe('components/Connect', () => {
component.setProps({
settings: {
- relayConstraints: {
+ relaySettings: {
host: 'se1.mullvad.net',
+ protocol: 'udp',
+ port: 1301,
},
},
});
@@ -186,10 +188,10 @@ const defaultProps = {
accountExpiry: '',
settings: {
- relayConstraints: {
+ relaySettings: {
host: 'www.example.com',
- port: 'any',
- protocol: 'any',
+ protocol: 'udp',
+ port: 1301,
},
},
connection: defaultConnection,
diff --git a/test/components/SelectLocation.spec.js b/test/components/SelectLocation.spec.js
index 28c9299807..937622cb36 100644
--- a/test/components/SelectLocation.spec.js
+++ b/test/components/SelectLocation.spec.js
@@ -10,10 +10,10 @@ import type { SelectLocationProps } from '../../app/components/SelectLocation';
describe('components/SelectLocation', () => {
const state: SettingsReduxState = {
- relayConstraints: {
- host: 'any',
- port: 'any',
- protocol: 'any',
+ relaySettings: {
+ host: 'example.com',
+ protocol: 'udp',
+ port: 1301,
},
};
diff --git a/test/components/Settings.spec.js b/test/components/Settings.spec.js
index 5d29aa0dd6..419c3e509c 100644
--- a/test/components/Settings.spec.js
+++ b/test/components/Settings.spec.js
@@ -35,10 +35,10 @@ describe('components/Settings', () => {
};
const settingsState: SettingsReduxState = {
- relayConstraints: {
- host: 'any',
- port: 'any',
- protocol: 'any',
+ relaySettings: {
+ host: 'example.com',
+ protocol: 'udp',
+ port: 1301,
},
};
diff --git a/test/connect.spec.js b/test/connect.spec.js
index 586df45980..a7f991ec50 100644
--- a/test/connect.spec.js
+++ b/test/connect.spec.js
@@ -7,15 +7,15 @@ import { IpcChain } from './helpers/IpcChain';
describe('connect', () => {
- it('should invoke update_relay_constraints and then connect in the backend', (done) => {
+ it('should invoke update_relay_settings and then connect in the backend', (done) => {
const { store, mockIpc, backend } = setupBackendAndStore();
const chain = new IpcChain(mockIpc);
- chain.require('updateRelayConstraints')
+ chain.require('updateRelaySettings')
.withInputValidation(
relayEndpoint => {
if (relayEndpoint) {
- expect(relayEndpoint.host.only).to.equal(arbitraryRelay);
+ expect(relayEndpoint.custom_tunnel_endpoint.host).to.equal(arbitraryRelay);
} else {
expect.fail();
}
@@ -52,7 +52,7 @@ describe('connect', () => {
it('should update the state with the server address', () => {
const { store, backend } = setupBackendAndStore();
- return backend.connect('www.example.com')
+ return backend.connect('www.example.com', 'udp', 1301)
.then( () => {
const state = store.getState().connection;
expect(state.status).to.equal('connecting');
diff --git a/test/mocks/ipc.js b/test/mocks/ipc.js
index 2bda0b3fd6..59655c03ab 100644
--- a/test/mocks/ipc.js
+++ b/test/mocks/ipc.js
@@ -28,14 +28,18 @@ export function newMockIpc() {
setAccount: () => Promise.resolve(),
- updateRelayConstraints: () => Promise.resolve(),
+ updateRelaySettings: () => Promise.resolve(),
- getRelayContraints: () => Promise.resolve({
- host: { only: 'www.example.com' },
- tunnel: { openvpn: {
- port: 'any',
- protocol: 'any',
- }},
+ getRelaySettings: () => Promise.resolve({
+ custom_tunnel_endpoint: {
+ host: 'www.example.com',
+ tunnel: {
+ openvpn: {
+ port: 1301,
+ protocol: 'udp',
+ }
+ }
+ },
}),
connect: () => Promise.resolve(),
@@ -44,11 +48,13 @@ export function newMockIpc() {
shutdown: () => Promise.resolve(),
- getIp: () => Promise.resolve('1.2.3.4'),
+ getPublicIp: () => Promise.resolve('1.2.3.4'),
getLocation: () => Promise.resolve({
- city: '',
country: '',
+ country_code: '',
+ city: '',
+ city_code: '',
position: [0, 0],
}),