Skip to content

Commit

Permalink
improved a test
Browse files Browse the repository at this point in the history
  • Loading branch information
MV88 committed Mar 31, 2017
1 parent 1ad2e3a commit 91553ae
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions web/client/epics/__tests__/search-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,12 +124,14 @@ describe('search Epics', () => {

let actions = store.getActions();
expect(actions.length).toBe(6);
expect(actions.filter(m => m.type === CHANGE_MAP_VIEW)[0].type).toBe(CHANGE_MAP_VIEW);
expect(actions.filter(m => m.type === TEXT_SEARCH_ADD_MARKER)[0].type).toBe(TEXT_SEARCH_ADD_MARKER);
expect(actions.filter(m => m.type === TEXT_SEARCH_RESULTS_PURGE)[0].type).toBe(TEXT_SEARCH_RESULTS_PURGE);
let expectedActions = [CHANGE_MAP_VIEW, TEXT_SEARCH_ADD_MARKER, TEXT_SEARCH_RESULTS_PURGE, TEXT_SEARCH_NESTED_SERVICES_SELECTED, TEXT_SEARCH_TEXT_CHANGE ];
let actionsType = actions.map(a => a.type);

expectedActions.forEach((a) => {
expect(actionsType.indexOf(a)).toNotBe(-1);
});

let testSearchNestedServicesSelectedAction = actions.filter(m => m.type === TEXT_SEARCH_NESTED_SERVICES_SELECTED)[0];
expect(testSearchNestedServicesSelectedAction.type).toBe(TEXT_SEARCH_NESTED_SERVICES_SELECTED);
expect(testSearchNestedServicesSelectedAction.services[0]).toEqual({
...nestedService,
options: {
Expand All @@ -141,7 +143,6 @@ describe('search Epics', () => {
placeholderMsgId: TEST_NESTED_PLACEHOLDER,
text: TEXT
});
expect(actions.filter(m => m.type === TEXT_SEARCH_TEXT_CHANGE)[0].type).toBe(TEXT_SEARCH_TEXT_CHANGE);
expect(actions.filter(m => m.type === TEXT_SEARCH_TEXT_CHANGE)[0].searchText).toBe(TEXT);
});

Expand Down

0 comments on commit 91553ae

Please sign in to comment.