debian-mirror-gitlab/spec/frontend/search_settings/index_spec.js

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

26 lines
693 B
JavaScript
Raw Normal View History

2021-03-11 19:13:27 +05:30
import { setHTMLFixture, resetHTMLFixture } from 'helpers/fixtures';
2021-03-08 18:12:59 +05:30
import initSearch from '~/search_settings';
2021-03-11 19:13:27 +05:30
import mount from '~/search_settings/mount';
2021-03-08 18:12:59 +05:30
2021-03-11 19:13:27 +05:30
jest.mock('~/search_settings/mount');
2021-03-08 18:12:59 +05:30
2021-03-11 19:13:27 +05:30
describe('~/search_settings', () => {
2021-03-08 18:12:59 +05:30
afterEach(() => {
2021-03-11 19:13:27 +05:30
resetHTMLFixture();
2021-03-08 18:12:59 +05:30
});
2021-03-11 19:13:27 +05:30
it('initializes search settings when js-search-settings-app is available', async () => {
setHTMLFixture('<div class="js-search-settings-app"></div>');
await initSearch();
2021-03-08 18:12:59 +05:30
2021-03-11 19:13:27 +05:30
expect(mount).toHaveBeenCalled();
2021-03-08 18:12:59 +05:30
});
2021-03-11 19:13:27 +05:30
it('does not initialize search settings when js-search-settings-app is unavailable', async () => {
await initSearch();
2021-03-08 18:12:59 +05:30
2021-03-11 19:13:27 +05:30
expect(mount).not.toHaveBeenCalled();
2021-03-08 18:12:59 +05:30
});
});