summaryrefslogtreecommitdiffhomepage
path: root/test
diff options
context:
space:
mode:
authorAndrej Mihajlov <and@codeispoetry.ru>2017-03-06 20:56:20 +0000
committerAndrej Mihajlov <and@codeispoetry.ru>2017-03-06 20:56:20 +0000
commitfe577023e038505c8fcffd93d92cd9bcf8771c4e (patch)
tree2e5911e4d87d99f36ee60e8276750b6c056e1fea /test
parent8ce1e7febe5ac00345d9e1fe3db53b5729baad8c (diff)
downloadmullvadvpn-fe577023e038505c8fcffd93d92cd9bcf8771c4e.tar.xz
mullvadvpn-fe577023e038505c8fcffd93d92cd9bcf8771c4e.zip
Add fetch() support for mocha
Diffstat (limited to 'test')
-rw-r--r--test/support.js14
1 files changed, 13 insertions, 1 deletions
diff --git a/test/support.js b/test/support.js
index 10387465d8..5cbf4630ba 100644
--- a/test/support.js
+++ b/test/support.js
@@ -4,6 +4,10 @@ import Backend from '../app/lib/backend';
import { defaultServer } from '../app/config';
import { LoginState, ConnectionState } from '../app/enums';
+// fetch is absent in node environment
+// this will automatically import it into global scope
+import fetch from 'isomorphic-fetch'; // eslint-disable-line no-unused-vars
+
const middlewares = [ thunk ];
export const mockStore = configureMockStore(middlewares);
export const mockState = () => {
@@ -36,6 +40,14 @@ export const mockBackend = (store) => {
export const filterIpUpdateActions = (actions) => {
return actions.filter((action) => {
- return !(action.type === 'CONNECTION_CHANGE' && action.payload.clientIp);
+ if(action.type === 'CONNECTION_CHANGE' && action.payload.clientIp) {
+ return false;
+ }
+
+ if(action.type === 'USER_LOGIN_CHANGE' && action.payload.city) {
+ return false;
+ }
+
+ return true;
});
};