2019-01-26 13:36:47 +01:00
|
|
|
import { expect } from 'chai';
|
2019-12-23 19:22:54 +01:00
|
|
|
import general, { defaultState } from './loading';
|
2019-01-26 13:36:47 +01:00
|
|
|
|
2019-12-23 19:22:54 +01:00
|
|
|
describe('reducers/loading', () => {
|
2019-01-26 13:36:47 +01:00
|
|
|
it('should return same state when no action matches', () => {
|
2019-12-23 19:22:54 +01:00
|
|
|
expect(general(defaultState, {} as any)).to.equal(defaultState);
|
2019-01-26 13:36:47 +01:00
|
|
|
});
|
|
|
|
|
|
|
|
describe('SET_IS_LOADING', () => {
|
|
|
|
it('sets loading state', () => {
|
2019-12-23 19:22:54 +01:00
|
|
|
const expectedState = true;
|
2019-01-26 13:36:47 +01:00
|
|
|
|
|
|
|
const actualState = general(undefined, {
|
|
|
|
type: 'SET_IS_LOADING',
|
|
|
|
isLoading: true,
|
|
|
|
});
|
|
|
|
|
|
|
|
expect(expectedState).to.eql(actualState);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|