diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-12-21 18:10:05 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-12-21 18:10:05 +0300 |
commit | cb3b8bd5897cb77b5a00278ab86db89c7ffa2efa (patch) | |
tree | ebccb2dd79320d49e3f8b33ad4d18387ff05d6b6 /spec/frontend/alert_management | |
parent | eb8836dea46945d5adf20be26efde222b73e17f9 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend/alert_management')
-rw-r--r-- | spec/frontend/alert_management/components/alert_details_spec.js | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/spec/frontend/alert_management/components/alert_details_spec.js b/spec/frontend/alert_management/components/alert_details_spec.js index e2d913398f9..976e50625a6 100644 --- a/spec/frontend/alert_management/components/alert_details_spec.js +++ b/spec/frontend/alert_management/components/alert_details_spec.js @@ -3,6 +3,7 @@ import { mount, shallowMount } from '@vue/test-utils'; import axios from 'axios'; import MockAdapter from 'axios-mock-adapter'; import { extendedWrapper } from 'helpers/vue_test_utils_helper'; +import waitForPromises from 'helpers/wait_for_promises'; import AlertDetails from '~/alert_management/components/alert_details.vue'; import AlertSummaryRow from '~/alert_management/components/alert_summary_row.vue'; import { @@ -201,6 +202,11 @@ describe('AlertDetails', () => { it('calls `$apollo.mutate` with `createIssueQuery`', () => { const issueIid = '10'; + mountComponent({ + mountMethod: mount, + data: { alert: { ...mockAlert } }, + }); + jest .spyOn(wrapper.vm.$apollo, 'mutate') .mockResolvedValue({ data: { createAlertIssue: { issue: { iid: issueIid } } } }); @@ -215,7 +221,7 @@ describe('AlertDetails', () => { }); }); - it('shows error alert when incident creation fails ', () => { + it('shows error alert when incident creation fails ', async () => { const errorMsg = 'Something went wrong'; mountComponent({ mountMethod: mount, @@ -225,9 +231,8 @@ describe('AlertDetails', () => { jest.spyOn(wrapper.vm.$apollo, 'mutate').mockRejectedValue(errorMsg); findCreateIncidentBtn().trigger('click'); - setImmediate(() => { - expect(findIncidentCreationAlert().text()).toBe(errorMsg); - }); + await waitForPromises(); + expect(findIncidentCreationAlert().text()).toBe(errorMsg); }); }); |