edited height_cache-test, identity_proofs-test, and list_adder-test

merge-requests/106/head
crockwave 2020-07-07 19:38:16 -05:00
rodzic acfd8fe2ac
commit 3481b4c728
3 zmienionych plików z 129 dodań i 0 usunięć

Wyświetl plik

@ -1,8 +1,17 @@
import reducer from '../height_cache';
import { Map as ImmutableMap } from 'immutable';
import { HEIGHT_CACHE_CLEAR } from '../height_cache';
describe('height_cache reducer', () => {
it('should return the initial state', () => {
expect(reducer(undefined, {})).toEqual(ImmutableMap());
});
it('should handle HEIGHT_CACHE_CLEAR', () => {
const state = ImmutableMap({ is_uploading: true });
const action = {
type: HEIGHT_CACHE_CLEAR,
};
expect(reducer(undefined, {})).toEqual(ImmutableMap());
})
});

Wyświetl plik

@ -1,8 +1,30 @@
import reducer from '../identity_proofs';
import { Map as ImmutableMap } from 'immutable';
import * as actions from '../identity_proofs';
describe('identity_proofs reducer', () => {
it('should return the initial state', () => {
expect(reducer(undefined, {})).toEqual(ImmutableMap());
});
// it('should handle IDENTITY_PROOFS_ACCOUNT_FETCH_REQUEST', () => {
// const state = ImmutableMap({ isLoading: false });
// const action = {
// type: actions.IDENTITY_PROOFS_ACCOUNT_FETCH_REQUEST,
// };
// expect(reducer(state, action).toJS()).toMatchObject({
// isLoading: true,
// });
// });
//
// it('should handle IDENTITY_PROOFS_ACCOUNT_FETCH_FAIL', () => {
// const state = ImmutableMap({ isLoading: true });
// const action = {
// type: actions.IDENTITY_PROOFS_ACCOUNT_FETCH_FAIL,
// };
// expect(reducer(state, action).toJS()).toMatchObject({
// isLoading: false,
// });
// });
});

Wyświetl plik

@ -1,5 +1,6 @@
import reducer from '../list_adder';
import { Map as ImmutableMap, List as ImmutableList } from 'immutable';
import * as actions from '../list_adder';
describe('list_adder reducer', () => {
it('should return the initial state', () => {
@ -13,4 +14,101 @@ describe('list_adder reducer', () => {
}),
}));
});
it('should handle LIST_ADDER_RESET', () => {
const state = ImmutableMap({
accountId: null,
lists: ImmutableMap({
items: ImmutableList(),
loaded: false,
isLoading: false,
}),
});
const action = {
type: actions.LIST_ADDER_RESET,
};
expect(reducer(state, action)).toEqual(ImmutableMap({
accountId: null,
lists: ImmutableMap({
items: ImmutableList(),
loaded: false,
isLoading: false,
}),
}));
});
// it('should handle LIST_ADDER_LISTS_FETCH_REQUEST', () => {
// const state = ImmutableMap({
// accountId: null,
//
// lists: ImmutableMap({
// items: ImmutableList(),
// loaded: false,
// isLoading: false,
// }),
// });
// const action = {
// type: actions.LIST_ADDER_LISTS_FETCH_REQUEST,
// };
// expect(reducer(state, action)).toEqual(ImmutableMap({
// accountId: null,
//
// lists: ImmutableMap({
// items: ImmutableList(),
// loaded: false,
// isLoading: true,
// }),
// }));
// });
it('should handle LIST_ADDER_LISTS_FETCH_FAIL', () => {
const state = ImmutableMap({
accountId: null,
lists: ImmutableMap({
items: ImmutableList(),
loaded: false,
isLoading: false,
}),
});
const action = {
type: actions.LIST_ADDER_LISTS_FETCH_FAIL,
};
expect(reducer(state, action)).toEqual(ImmutableMap({
accountId: null,
lists: ImmutableMap({
items: ImmutableList(),
loaded: false,
isLoading: false,
}),
}));
});
// it('should handle LIST_ADDER_LISTS_FETCH_SUCCESS', () => {
// const state = ImmutableMap({
// accountId: null,
//
// lists: ImmutableMap({
// items: ImmutableList(),
// loaded: false,
// isLoading: false,
// }),
// });
// const action = {
// type: actions.LIST_ADDER_LISTS_FETCH_SUCCESS,
// };
// expect(reducer(state, action)).toEqual(ImmutableMap({
// accountId: null,
//
// lists: ImmutableMap({
// items: ImmutableList(),
// loaded: true,
// isLoading: false,
// }),
// }));
// });
});