summaryrefslogtreecommitdiffhomepage
path: root/test
diff options
context:
space:
mode:
authorAndrej Mihajlov <and@codeispoetry.ru>2017-03-21 18:31:51 +0000
committerAndrej Mihajlov <and@codeispoetry.ru>2017-03-21 18:31:51 +0000
commitf4fb6a08f84cbe5ef7c906167619291ed6747fec (patch)
tree4b4d05f251a303d7bc5950a8ef4a64abcc88e05f /test
parentce3dcc35cdae34c4b95e5c60783a5a8dce42f3a4 (diff)
downloadmullvadvpn-f4fb6a08f84cbe5ef7c906167619291ed6747fec.tar.xz
mullvadvpn-f4fb6a08f84cbe5ef7c906167619291ed6747fec.zip
Filter out isOnline updates for main tests
Diffstat (limited to 'test')
-rw-r--r--test/actions.spec.js20
-rw-r--r--test/mocks/backend.js6
-rw-r--r--test/routing.spec.js6
3 files changed, 18 insertions, 14 deletions
diff --git a/test/actions.spec.js b/test/actions.spec.js
index 6fe0ac398f..84a53c935f 100644
--- a/test/actions.spec.js
+++ b/test/actions.spec.js
@@ -1,5 +1,5 @@
import { expect } from 'chai';
-import { filterIpUpdateActions, mockBackend, mockState, mockStore } from './mocks/backend';
+import { filterMinorActions, mockBackend, mockState, mockStore } from './mocks/backend';
import Backend from '../app/lib/backend';
import userActions from '../app/actions/user';
import connectActions from '../app/actions/connect';
@@ -19,7 +19,7 @@ describe('actions', function() {
mapBackendEventsToReduxActions(backend, store);
backend.once(Backend.EventType.login, () => {
- const storeActions = filterIpUpdateActions(store.getActions());
+ const storeActions = filterMinorActions(store.getActions());
expect(storeActions).deep.equal(expectedActions);
done();
});
@@ -45,7 +45,7 @@ describe('actions', function() {
mapBackendEventsToReduxActions(backend, store);
backend.once(Backend.EventType.logout, () => {
- const storeActions = filterIpUpdateActions(store.getActions());
+ const storeActions = filterMinorActions(store.getActions());
expect(storeActions).deep.equal(expectedActions);
done();
@@ -56,8 +56,8 @@ describe('actions', function() {
it('should connect to VPN server', (done) => {
const expectedActions = [
- { type: 'CONNECTION_CHANGE', payload: { serverAddress: '1.2.3.4', status: 'connecting', error: null } },
- { type: 'CONNECTION_CHANGE', payload: { status: 'connected', error: null } }
+ { type: 'CONNECTION_CHANGE', payload: { serverAddress: '1.2.3.4', status: 'connecting' } },
+ { type: 'CONNECTION_CHANGE', payload: { status: 'connected' } }
];
let state = Object.assign(mockState(), {
@@ -73,7 +73,7 @@ describe('actions', function() {
mapBackendEventsToReduxActions(backend, store);
backend.once(Backend.EventType.connect, () => {
- const storeActions = filterIpUpdateActions(store.getActions());
+ const storeActions = filterMinorActions(store.getActions());
expect(storeActions).deep.equal(expectedActions);
done();
@@ -84,7 +84,7 @@ describe('actions', function() {
it('should disconnect from VPN server', (done) => {
const expectedActions = [
- { type: 'CONNECTION_CHANGE', payload: { serverAddress: null, status: 'disconnected', error: null } }
+ { type: 'CONNECTION_CHANGE', payload: { serverAddress: null, status: 'disconnected' } }
];
let state = Object.assign(mockState(), {
@@ -104,7 +104,7 @@ describe('actions', function() {
mapBackendEventsToReduxActions(backend, store);
backend.once(Backend.EventType.disconnect, () => {
- const storeActions = filterIpUpdateActions(store.getActions());
+ const storeActions = filterMinorActions(store.getActions());
expect(storeActions).deep.equal(expectedActions);
done();
@@ -116,7 +116,7 @@ describe('actions', function() {
it('should disconnect from VPN server on logout', (done) => {
const expectedActions = [
{ type: 'USER_LOGIN_CHANGE', payload: { account: null, paidUntil: null, status: 'none', error: null } },
- { type: 'CONNECTION_CHANGE', payload: { serverAddress: null, status: 'disconnected', error: null } }
+ { type: 'CONNECTION_CHANGE', payload: { serverAddress: null, status: 'disconnected' } }
];
let state = Object.assign(mockState(), {
@@ -136,7 +136,7 @@ describe('actions', function() {
mapBackendEventsToReduxActions(backend, store);
backend.once(Backend.EventType.disconnect, () => {
- const storeActions = filterIpUpdateActions(store.getActions());
+ const storeActions = filterMinorActions(store.getActions());
expect(storeActions).deep.equal(expectedActions);
done();
diff --git a/test/mocks/backend.js b/test/mocks/backend.js
index 1588421098..bac5fac19e 100644
--- a/test/mocks/backend.js
+++ b/test/mocks/backend.js
@@ -38,11 +38,15 @@ export const mockBackend = (store) => {
return backend;
};
-export const filterIpUpdateActions = (actions) => {
+export const filterMinorActions = (actions) => {
return actions.filter((action) => {
if(action.type === 'CONNECTION_CHANGE' && action.payload.clientIp) {
return false;
}
+
+ if(action.type === 'CONNECTION_CHANGE' && action.payload.isOnline) {
+ return false;
+ }
if(action.type === 'USER_LOGIN_CHANGE' && action.payload.city) {
return false;
diff --git a/test/routing.spec.js b/test/routing.spec.js
index 5b546e8851..38af64b58c 100644
--- a/test/routing.spec.js
+++ b/test/routing.spec.js
@@ -1,6 +1,6 @@
import { expect } from 'chai';
-import { filterIpUpdateActions, mockBackend, mockState, mockStore } from './mocks/backend';
+import { filterMinorActions, mockBackend, mockState, mockStore } from './mocks/backend';
import userActions from '../app/actions/user';
import mapBackendEventsToRouter from '../app/lib/backend-routing';
import { LoginState } from '../app/enums';
@@ -26,7 +26,7 @@ describe('routing', function() {
store.dispatch(userActions.logout(backend));
- const storeActions = filterIpUpdateActions(store.getActions());
+ const storeActions = filterMinorActions(store.getActions());
expect(storeActions).deep.equal(expectedActions);
});
@@ -46,7 +46,7 @@ describe('routing', function() {
mapBackendEventsToRouter(backend, store);
store.subscribe(() => {
- const storeActions = filterIpUpdateActions(store.getActions());
+ const storeActions = filterMinorActions(store.getActions());
expect(storeActions).deep.equal(expectedActions);
done();
});