summaryrefslogtreecommitdiff
path: root/spec/frontend/header_search/store/actions_spec.js
blob: 4530df0d91c44d9f0efc78bfbb9f08b7f27a39a6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import testAction from 'helpers/vuex_action_helper';
import * as actions from '~/header_search/store/actions';
import * as types from '~/header_search/store/mutation_types';
import createState from '~/header_search/store/state';
import { MOCK_SEARCH } from '../mock_data';

describe('Header Search Store Actions', () => {
  let state;

  beforeEach(() => {
    state = createState({});
  });

  afterEach(() => {
    state = null;
  });

  describe('setSearch', () => {
    it('calls the SET_SEARCH mutation', () => {
      return testAction({
        action: actions.setSearch,
        payload: MOCK_SEARCH,
        state,
        expectedMutations: [{ type: types.SET_SEARCH, payload: MOCK_SEARCH }],
      });
    });
  });
});