Commit 397b236c authored by Paul Slaughter's avatar Paul Slaughter

Remove unneeded parts in mount_search_settings_spec

- We can simply wait for the method (no need for wait_for_promises)
- `mockReset` isn't needed due to jest config
parent 94b086a8
import waitForPromises from 'helpers/wait_for_promises';
import { setHTMLFixture, resetHTMLFixture } from 'helpers/fixtures'; import { setHTMLFixture, resetHTMLFixture } from 'helpers/fixtures';
import initSearch from '~/search_settings'; import initSearch from '~/search_settings';
import mountSearchSettings from '~/pages/projects/edit/mount_search_settings'; import mountSearchSettings from '~/pages/projects/edit/mount_search_settings';
...@@ -7,24 +6,19 @@ jest.mock('~/search_settings'); ...@@ -7,24 +6,19 @@ jest.mock('~/search_settings');
describe('pages/projects/edit/mount_search_settings', () => { describe('pages/projects/edit/mount_search_settings', () => {
afterEach(() => { afterEach(() => {
initSearch.mockReset();
resetHTMLFixture(); resetHTMLFixture();
}); });
it('initializes search settings when js-search-settings-app is available', async () => { it('initializes search settings when js-search-settings-app is available', async () => {
setHTMLFixture('<div class="js-search-settings-app"></div>'); setHTMLFixture('<div class="js-search-settings-app"></div>');
mountSearchSettings(); await mountSearchSettings();
await waitForPromises();
expect(initSearch).toHaveBeenCalled(); expect(initSearch).toHaveBeenCalled();
}); });
it('does not initialize search settings when js-search-settings-app is unavailable', async () => { it('does not initialize search settings when js-search-settings-app is unavailable', async () => {
mountSearchSettings(); await mountSearchSettings();
await waitForPromises();
expect(initSearch).not.toHaveBeenCalled(); expect(initSearch).not.toHaveBeenCalled();
}); });
......
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