diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-02-18 09:45:46 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-02-18 09:45:46 +0000 |
commit | a7b3560714b4d9cc4ab32dffcd1f74a284b93580 (patch) | |
tree | 7452bd5c3545c2fa67a28aa013835fb4fa071baf /spec/frontend/operation_settings | |
parent | ee9173579ae56a3dbfe5afe9f9410c65bb327ca7 (diff) | |
download | gitlab-ce-a7b3560714b4d9cc4ab32dffcd1f74a284b93580.tar.gz |
Add latest changes from gitlab-org/gitlab@14-8-stable-eev14.8.0-rc42
Diffstat (limited to 'spec/frontend/operation_settings')
-rw-r--r-- | spec/frontend/operation_settings/components/metrics_settings_spec.js | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/spec/frontend/operation_settings/components/metrics_settings_spec.js b/spec/frontend/operation_settings/components/metrics_settings_spec.js index 258c6eae692..c1fa1d24a82 100644 --- a/spec/frontend/operation_settings/components/metrics_settings_spec.js +++ b/spec/frontend/operation_settings/components/metrics_settings_spec.js @@ -1,5 +1,6 @@ import { GlButton, GlLink, GlFormGroup, GlFormInput, GlFormSelect } from '@gitlab/ui'; import { mount, shallowMount } from '@vue/test-utils'; +import { nextTick } from 'vue'; import { TEST_HOST } from 'helpers/test_constants'; import createFlash from '~/flash'; import axios from '~/lib/utils/axios_utils'; @@ -181,17 +182,18 @@ describe('operation settings external dashboard component', () => { expect(submit.text()).toBe('Save Changes'); }); - it('submits form on click', () => { + it('submits form on click', async () => { mountComponent(false); axios.patch.mockResolvedValue(); findSubmitButton().trigger('click'); expect(axios.patch).toHaveBeenCalledWith(...endpointRequest); - return wrapper.vm.$nextTick().then(() => expect(refreshCurrentPage).toHaveBeenCalled()); + await nextTick(); + expect(refreshCurrentPage).toHaveBeenCalled(); }); - it('creates flash banner on error', () => { + it('creates flash banner on error', async () => { mountComponent(false); const message = 'mockErrorMessage'; axios.patch.mockRejectedValue({ response: { data: { message } } }); @@ -199,14 +201,11 @@ describe('operation settings external dashboard component', () => { expect(axios.patch).toHaveBeenCalledWith(...endpointRequest); - return wrapper.vm - .$nextTick() - .then(jest.runAllTicks) - .then(() => - expect(createFlash).toHaveBeenCalledWith({ - message: `There was an error saving your changes. ${message}`, - }), - ); + await nextTick(); + await jest.runAllTicks(); + expect(createFlash).toHaveBeenCalledWith({ + message: `There was an error saving your changes. ${message}`, + }); }); }); }); |