debian-mirror-gitlab/spec/frontend/filtered_search/recent_searches_root_spec.js

33 lines
778 B
JavaScript
Raw Normal View History

2020-05-24 23:13:21 +05:30
import Vue from 'vue';
2017-08-17 22:00:37 +05:30
import RecentSearchesRoot from '~/filtered_search/recent_searches_root';
2020-05-24 23:13:21 +05:30
jest.mock('vue');
2017-08-17 22:00:37 +05:30
describe('RecentSearchesRoot', () => {
describe('render', () => {
let recentSearchesRoot;
let data;
let template;
beforeEach(() => {
recentSearchesRoot = {
store: {
state: 'state',
},
};
2020-05-24 23:13:21 +05:30
Vue.mockImplementation(options => {
2018-11-08 19:23:39 +05:30
({ data, template } = options);
2017-08-17 22:00:37 +05:30
});
RecentSearchesRoot.prototype.render.call(recentSearchesRoot);
});
it('should instantiate Vue', () => {
2020-05-24 23:13:21 +05:30
expect(Vue).toHaveBeenCalled();
2017-08-17 22:00:37 +05:30
expect(data()).toBe(recentSearchesRoot.store.state);
expect(template).toContain(':is-local-storage-available="isLocalStorageAvailable"');
});
});
});