Commit 91db0aef authored by Himanshu Kapoor's avatar Himanshu Kapoor

Migrate some filtered_search specs to Jest

parent de47746a
import Vue from 'vue';
import RecentSearchesRoot from '~/filtered_search/recent_searches_root'; import RecentSearchesRoot from '~/filtered_search/recent_searches_root';
jest.mock('vue');
describe('RecentSearchesRoot', () => { describe('RecentSearchesRoot', () => {
describe('render', () => { describe('render', () => {
let recentSearchesRoot; let recentSearchesRoot;
let data; let data;
let template; let template;
let VueSpy;
beforeEach(() => { beforeEach(() => {
recentSearchesRoot = { recentSearchesRoot = {
...@@ -14,7 +16,7 @@ describe('RecentSearchesRoot', () => { ...@@ -14,7 +16,7 @@ describe('RecentSearchesRoot', () => {
}, },
}; };
VueSpy = spyOnDependency(RecentSearchesRoot, 'Vue').and.callFake(options => { Vue.mockImplementation(options => {
({ data, template } = options); ({ data, template } = options);
}); });
...@@ -22,7 +24,7 @@ describe('RecentSearchesRoot', () => { ...@@ -22,7 +24,7 @@ describe('RecentSearchesRoot', () => {
}); });
it('should instantiate Vue', () => { it('should instantiate Vue', () => {
expect(VueSpy).toHaveBeenCalled(); expect(Vue).toHaveBeenCalled();
expect(data()).toBe(recentSearchesRoot.store.state); expect(data()).toBe(recentSearchesRoot.store.state);
expect(template).toContain(':is-local-storage-available="isLocalStorageAvailable"'); expect(template).toContain(':is-local-storage-available="isLocalStorageAvailable"');
}); });
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment