summaryrefslogtreecommitdiffhomepage
path: root/test
diff options
context:
space:
mode:
authorAndrej Mihajlov <and@codeispoetry.ru>2017-06-19 19:11:49 +0300
committerAndrej Mihajlov <and@codeispoetry.ru>2017-06-21 16:13:32 +0300
commit1137b82c76214f37e7d88ff2e6068705da52e7dc (patch)
tree9fe97235c2d92c429a31a79181c94b902393b7e5 /test
parent5ae8eda0075ec72424c478fdf1ff731db43b0ff5 (diff)
downloadmullvadvpn-1137b82c76214f37e7d88ff2e6068705da52e7dc.tar.xz
mullvadvpn-1137b82c76214f37e7d88ff2e6068705da52e7dc.zip
- Migrate Backend.EventType and Backend.ErrorType to Flow
- Export Backend and BackendError separately
Diffstat (limited to 'test')
-rw-r--r--test/actions.spec.js17
-rw-r--r--test/routing.spec.js8
2 files changed, 12 insertions, 13 deletions
diff --git a/test/actions.spec.js b/test/actions.spec.js
index 914483161e..d1bffe2d5e 100644
--- a/test/actions.spec.js
+++ b/test/actions.spec.js
@@ -1,8 +1,7 @@
// @flow
-
import { expect } from 'chai';
import { filterMinorActions, mockState, mockStore } from './mocks/redux';
-import Backend from '../app/lib/backend';
+import { Backend } from '../app/lib/backend';
import { newMockIpc } from './mocks/ipc';
import userActions from '../app/actions/user';
import connectActions from '../app/actions/connect';
@@ -28,7 +27,7 @@ describe('actions', function() {
mapBackendEventsToReduxActions(backend, store);
- backend.once(Backend.EventType.login, () => {
+ backend.once('login', () => {
const storeActions = filterMinorActions(store.getActions());
expect(storeActions).deep.equal(expectedActions);
done();
@@ -47,7 +46,7 @@ describe('actions', function() {
const backend = new Backend(mockIpc);
mapBackendEventsToReduxActions(backend, store);
- backend.once(Backend.EventType.logout, () => {
+ backend.once('logout', () => {
const storeActions = filterMinorActions(store.getActions());
expect(storeActions).deep.equal(expectedActions);
@@ -73,7 +72,7 @@ describe('actions', function() {
};
mapBackendEventsToReduxActions(backend, store);
- backend.once(Backend.EventType.connect, () => {
+ backend.once('connect', () => {
const storeActions = filterMinorActions(store.getActions())
.filter(action => {
@@ -83,8 +82,8 @@ describe('actions', function() {
expect(storeActions).deep.equal(expectedActions);
done();
});
-
- backend.once(Backend.EventType.login, () => {
+
+ backend.once('login', () => {
store.dispatch(connectActions.connect(backend, '1.2.3.4'));
});
store.dispatch(userActions.login(backend, '1'));
@@ -111,7 +110,7 @@ describe('actions', function() {
const backend = new Backend(newMockIpc());
mapBackendEventsToReduxActions(backend, store);
- backend.once(Backend.EventType.disconnect, () => {
+ backend.once('disconnect', () => {
const storeActions = filterMinorActions(store.getActions());
expect(storeActions).deep.equal(expectedActions);
@@ -143,7 +142,7 @@ describe('actions', function() {
const backend = new Backend(newMockIpc());
mapBackendEventsToReduxActions(backend, store);
- backend.once(Backend.EventType.disconnect, () => {
+ backend.once('disconnect', () => {
const storeActions = filterMinorActions(store.getActions());
expect(storeActions).deep.equal(expectedActions);
diff --git a/test/routing.spec.js b/test/routing.spec.js
index e728ca59a6..062c1e5246 100644
--- a/test/routing.spec.js
+++ b/test/routing.spec.js
@@ -3,7 +3,7 @@ import { expect } from 'chai';
import { filterMinorActions, mockState, mockStore } from './mocks/redux';
import userActions from '../app/actions/user';
import mapBackendEventsToRouter from '../app/lib/backend-routing';
-import Backend from '../app/lib/backend';
+import { Backend } from '../app/lib/backend';
import { newMockIpc } from './mocks/ipc';
describe('routing', function() {
@@ -24,7 +24,7 @@ describe('routing', function() {
const store = mockStore(state);
const backend = new Backend(newMockIpc());
mapBackendEventsToRouter(backend, store);
-
+
store.dispatch(userActions.logout(backend));
setTimeout(() => {
@@ -37,11 +37,11 @@ describe('routing', function() {
const expectedActions = [
{ type: '@@router/CALL_HISTORY_METHOD', payload: { method: 'replace', args: [ '/connect' ] } }
];
-
+
const store = mockStore(mockState());
const backend = new Backend(newMockIpc());
mapBackendEventsToRouter(backend, store);
-
+
store.subscribe(() => {
const storeActions = filterMinorActions(store.getActions());
expect(storeActions).deep.equal(expectedActions);