Commit 7bb91475 authored by Wietse Kuipers's avatar Wietse Kuipers
Browse files

Merge branch 'feature/reducer-test' into 'master'

Add test for calendar reducer

See merge request !143
parents ed6a23e1 30d11699
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`calendar reducer initially should not be fetched 1`] = `
Object {
"eventList": Array [],
"loading": true,
"status": "initial",
}
`;
import reducer from '../../app/reducers/calendar';
import * as actions from '../../app/actions/calendar';
describe('calendar reducer', () => {
const initial = reducer();
describe('initially', () => {
it('should not be fetched', () => {
expect(initial).toMatchSnapshot();
});
});
describe('is refreshing', () => {
const state = reducer(
{ loading: false },
actions.refresh(),
);
it('should be loading', () => {
expect(state).toHaveProperty('loading', true);
});
});
describe('is successful', () => {
const state = reducer(
initial,
actions.success([{ pk: 1 }]),
);
it('should not be loading', () => {
expect(state).toHaveProperty('loading', false);
});
it('should have events', () => {
expect(state).toHaveProperty('eventList', [{ pk: 1 }]);
});
it('should have status success', () => {
expect(state).toHaveProperty('status', 'success');
});
});
describe('is failure', () => {
const state = reducer(
initial,
actions.failure(),
);
it('should not be loading', () => {
expect(state).toHaveProperty('loading', false);
});
it('should not have events', () => {
expect(state).toHaveProperty('eventList', []);
});
it('should have status failure', () => {
expect(state).toHaveProperty('status', 'failure');
});
});
});
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment