diff options
Diffstat (limited to 'spec/frontend/search/store/mutations_spec.js')
-rw-r--r-- | spec/frontend/search/store/mutations_spec.js | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/spec/frontend/search/store/mutations_spec.js b/spec/frontend/search/store/mutations_spec.js index a79ec8f70b0..d604cf38f8f 100644 --- a/spec/frontend/search/store/mutations_spec.js +++ b/spec/frontend/search/store/mutations_spec.js @@ -8,6 +8,7 @@ import { MOCK_NAVIGATION_DATA, MOCK_NAVIGATION_ACTION_MUTATION, MOCK_DATA_FOR_NAVIGATION_ACTION_MUTATION, + MOCK_AGGREGATIONS, } from '../mock_data'; describe('Global Search Store Mutations', () => { @@ -108,4 +109,17 @@ describe('Global Search Store Mutations', () => { ); }); }); + + describe.each` + mutation | data | result + ${types.REQUEST_AGGREGATIONS} | ${[]} | ${{ fetching: true, error: false, data: [] }} + ${types.RECEIVE_AGGREGATIONS_SUCCESS} | ${MOCK_AGGREGATIONS} | ${{ fetching: false, error: false, data: MOCK_AGGREGATIONS }} + ${types.RECEIVE_AGGREGATIONS_ERROR} | ${[]} | ${{ fetching: false, error: true, data: [] }} + `('$mutation', ({ mutation, data, result }) => { + it('sets correct object content', () => { + mutations[mutation](state, data); + + expect(state.aggregations).toStrictEqual(result); + }); + }); }); |