Skip to content

Commit

Permalink
[tests] Added missing tests for contacts reducer.
Browse files Browse the repository at this point in the history
  • Loading branch information
seland committed Sep 8, 2018
1 parent c5763c6 commit 38bb5a6
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions __tests__/src/reducers/contacts.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import {
startContactsFetch,
contactsUpdated,
addContact,
contactsFetchFailed,
} from '../../../src/actions/contacts';
import { servicesDestroyed } from '../../../src/actions/serviceContainer';

Expand Down Expand Up @@ -36,6 +37,17 @@ describe('contacts reducer action handling', () => {
});
});

test('contactsFetchFailed', () => {
const errorMock = new Error('MOCK: Contact fetch failed');
const stateBefore = initialState;
const stateAfter = reducer(stateBefore, contactsFetchFailed(errorMock));
expect(stateAfter).toEqual({
...stateBefore,
isFetching: false,
fetchError: errorMock,
});
});

test('contactsUpdated', () => {
const stateBefore = initialState;
const stateAfter = reducer(stateBefore, contactsUpdated([contactsMock]));
Expand Down

0 comments on commit 38bb5a6

Please sign in to comment.