summaryrefslogtreecommitdiffhomepage
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
parent8ce1e7febe5ac00345d9e1fe3db53b5729baad8c (diff)
downloadmullvadvpn-fe577023e038505c8fcffd93d92cd9bcf8771c4e.tar.xz
mullvadvpn-fe577023e038505c8fcffd93d92cd9bcf8771c4e.zip
Add fetch() support for mocha
-rw-r--r--package.json1
-rw-r--r--test/support.js14
2 files changed, 14 insertions, 1 deletions
diff --git a/package.json b/package.json
index 5de736d238..43d5e8cdbf 100644
--- a/package.json
+++ b/package.json
@@ -46,6 +46,7 @@
"electron-devtools-installer": "^2.1.0",
"eslint": "^3.14.1",
"eslint-plugin-react": "^6.9.0",
+ "isomorphic-fetch": "^2.2.1",
"mocha": "^3.2.0",
"npm-run-all": "^4.0.1",
"redux-mock-store": "^1.2.2",
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;
});
};