summaryrefslogtreecommitdiff
path: root/spec/javascripts/filtered_search/recent_searches_root_spec.js
blob: d063fcf4f2da370d209ba00814be5766f2e23123 (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
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, template } = options);
      });

      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"');
    });
  });
});