2021-01-31 16:09:10 -05:00
|
|
|
import { setHTMLFixture, resetHTMLFixture } from 'helpers/fixtures';
|
2021-01-07 04:10:22 -05:00
|
|
|
import initSearch from '~/search_settings';
|
2021-01-31 16:09:10 -05:00
|
|
|
import mount from '~/search_settings/mount';
|
2021-01-07 04:10:22 -05:00
|
|
|
|
2021-01-31 16:09:10 -05:00
|
|
|
jest.mock('~/search_settings/mount');
|
2021-01-07 04:10:22 -05:00
|
|
|
|
2021-01-31 16:09:10 -05:00
|
|
|
describe('~/search_settings', () => {
|
2021-01-07 04:10:22 -05:00
|
|
|
afterEach(() => {
|
2021-01-31 16:09:10 -05:00
|
|
|
resetHTMLFixture();
|
2021-01-07 04:10:22 -05:00
|
|
|
});
|
|
|
|
|
2021-01-31 16:09:10 -05:00
|
|
|
it('initializes search settings when js-search-settings-app is available', async () => {
|
|
|
|
setHTMLFixture('<div class="js-search-settings-app"></div>');
|
|
|
|
|
|
|
|
await initSearch();
|
2021-01-07 04:10:22 -05:00
|
|
|
|
2021-01-31 16:09:10 -05:00
|
|
|
expect(mount).toHaveBeenCalled();
|
2021-01-07 04:10:22 -05:00
|
|
|
});
|
|
|
|
|
2021-01-31 16:09:10 -05:00
|
|
|
it('does not initialize search settings when js-search-settings-app is unavailable', async () => {
|
|
|
|
await initSearch();
|
2021-01-07 04:10:22 -05:00
|
|
|
|
2021-01-31 16:09:10 -05:00
|
|
|
expect(mount).not.toHaveBeenCalled();
|
2021-01-07 04:10:22 -05:00
|
|
|
});
|
|
|
|
});
|