summaryrefslogtreecommitdiff
path: root/spec/frontend/filtered_search/recent_searches_root_spec.js
blob: 6bb9e68d591f71c95edcaa5ca7d909453857d9e3 (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
29
30
31
32
import Vue from 'vue';
import RecentSearchesRoot from '~/filtered_search/recent_searches_root';

jest.mock('vue');

describe('RecentSearchesRoot', () => {
  describe('render', () => {
    let recentSearchesRoot;
    let data;
    let template;

    beforeEach(() => {
      recentSearchesRoot = {
        store: {
          state: 'state',
        },
      };

      Vue.mockImplementation((options) => {
        ({ data, template } = options);
      });

      RecentSearchesRoot.prototype.render.call(recentSearchesRoot);
    });

    it('should instantiate Vue', () => {
      expect(Vue).toHaveBeenCalled();
      expect(data()).toBe(recentSearchesRoot.store.state);
      expect(template).toContain(':is-local-storage-available="isLocalStorageAvailable"');
    });
  });
});