summaryrefslogtreecommitdiff
path: root/spec/javascripts/filtered_search/recent_searches_root_spec.js
blob: 1e6272bad0b5b83f781e369ebec6ded116019516 (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
import RecentSearchesRoot from '~/filtered_search/recent_searches_root';

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

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

      VueSpy = spyOnDependency(RecentSearchesRoot, 'Vue').and.callFake((options) => {
        data = options.data;
        template = options.template;
      });

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

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