diff options
| author | Andrej Mihajlov <and@mullvad.net> | 2018-07-16 16:33:56 +0200 |
|---|---|---|
| committer | Andrej Mihajlov <and@mullvad.net> | 2018-07-16 16:33:56 +0200 |
| commit | 7aa861495ffe90e0b5a9b9c67b8ccf0ad62c2882 (patch) | |
| tree | 212056880e20c6a3bdcc9e1e807bd75b1a4199af /test | |
| parent | 901d0135651d010088105e98204af7618347389d (diff) | |
| parent | 6c0618e8b500499576cb1b6969ce268c90df01b1 (diff) | |
| download | mullvadvpn-7aa861495ffe90e0b5a9b9c67b8ccf0ad62c2882.tar.xz mullvadvpn-7aa861495ffe90e0b5a9b9c67b8ccf0ad62c2882.zip | |
Merge branch 'auto-connect-settings'
Diffstat (limited to 'test')
| -rw-r--r-- | test/components/Preferences.spec.js | 6 | ||||
| -rw-r--r-- | test/components/SelectLocation.spec.js | 1 | ||||
| -rw-r--r-- | test/components/Settings.spec.js | 1 | ||||
| -rw-r--r-- | test/mocks/rpc.js | 103 |
4 files changed, 7 insertions, 104 deletions
diff --git a/test/components/Preferences.spec.js b/test/components/Preferences.spec.js index 280b24ccd7..f8c38f9493 100644 --- a/test/components/Preferences.spec.js +++ b/test/components/Preferences.spec.js @@ -17,7 +17,11 @@ describe('components/Preferences', () => { function makeProps(props) { return { onClose: () => {}, - onChangeAllowLan: () => {}, + setAutoConnect: () => {}, + setAutoStart: (_autoStart) => Promise.resolve(), + getAutoStart: () => false, + setAllowLan: () => {}, + allowAutoConnect: false, allowLan: false, ...props, }; diff --git a/test/components/SelectLocation.spec.js b/test/components/SelectLocation.spec.js index c9a1f08864..dbfe15221a 100644 --- a/test/components/SelectLocation.spec.js +++ b/test/components/SelectLocation.spec.js @@ -39,6 +39,7 @@ describe('components/SelectLocation', () => { ], }, ], + autoConnect: false, allowLan: false, }; diff --git a/test/components/Settings.spec.js b/test/components/Settings.spec.js index ffdf0bf545..2a152e1cc8 100644 --- a/test/components/Settings.spec.js +++ b/test/components/Settings.spec.js @@ -42,6 +42,7 @@ describe('components/Settings', () => { }, }, relayLocations: [], + autoConnect: false, allowLan: false, }; diff --git a/test/mocks/rpc.js b/test/mocks/rpc.js deleted file mode 100644 index 4b37ca35aa..0000000000 --- a/test/mocks/rpc.js +++ /dev/null @@ -1,103 +0,0 @@ -// @flow -import type { - DaemonRpcProtocol, - AccountToken, - AccountData, - BackendState, -} from '../../app/lib/daemon-rpc'; - -interface MockRpc { - sendNewState: (BackendState) => void; - -getAccountData: (AccountToken) => Promise<AccountData>; - -connectTunnel: () => Promise<void>; - -getAccount: () => Promise<?AccountToken>; - -authenticate: (string) => Promise<void>; -} - -export function newMockRpc() { - const stateListeners = []; - const openListeners = []; - const closeListeners = []; - - const mockIpc: DaemonRpcProtocol & MockRpc = { - setConnectionString: (_str: string) => {}, - getAccountData: (accountToken) => - Promise.resolve({ - accountToken: accountToken, - expiry: '', - }), - getRelayLocations: () => - Promise.resolve({ - countries: [], - }), - getAccount: () => Promise.resolve('1111'), - setAccount: () => Promise.resolve(), - updateRelaySettings: () => Promise.resolve(), - getRelaySettings: () => - Promise.resolve({ - custom_tunnel_endpoint: { - host: 'www.example.com', - tunnel: { - openvpn: { - port: 1301, - protocol: 'udp', - }, - }, - }, - }), - setAllowLan: (_allowLan: boolean) => Promise.resolve(), - getAllowLan: () => Promise.resolve(true), - connect: () => { - for (const listener of openListeners) { - listener(); - } - }, - disconnect: () => { - for (const listener of closeListeners) { - listener(); - } - }, - connectTunnel: () => Promise.resolve(), - disconnectTunnel: () => Promise.resolve(), - getLocation: () => - Promise.resolve({ - ip: '', - country: '', - city: '', - latitude: 0.0, - longitude: 0.0, - mullvad_exit_ip: false, - }), - getState: () => - Promise.resolve({ - state: 'unsecured', - target_state: 'unsecured', - }), - subscribeStateListener: (listener: (state: ?BackendState, error: ?Error) => void) => { - stateListeners.push(listener); - return Promise.resolve(); - }, - sendNewState: (state: BackendState) => { - for (const listener of stateListeners) { - listener(state); - } - }, - addOpenConnectionObserver: (listener: () => void) => { - openListeners.push(listener); - return { - unsubscribe: () => {}, - }; - }, - addCloseConnectionObserver: (listener: (error: ?Error) => void) => { - closeListeners.push(listener); - return { - unsubscribe: () => {}, - }; - }, - authenticate: (_secret: string) => Promise.resolve(), - getAccountHistory: () => Promise.resolve([]), - removeAccountFromHistory: (_accountToken) => Promise.resolve(), - }; - - return mockIpc; -} |
