Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-12-07 18:15:03 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2021-12-07 18:15:03 +0300
commit3a0f6ebaa9a80e34c09f599a624f6e4520009ef1 (patch)
tree4560fa6bcba7d950595e906ee3286dd1e44642f1 /spec/frontend/crm
parent6dd9e3644eea1a5c605a6a623cae1d53b156b9e5 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend/crm')
-rw-r--r--spec/frontend/crm/contacts_root_spec.js10
-rw-r--r--spec/frontend/crm/new_contact_form_spec.js14
2 files changed, 8 insertions, 16 deletions
diff --git a/spec/frontend/crm/contacts_root_spec.js b/spec/frontend/crm/contacts_root_spec.js
index c7410d13365..18bd2d7c45b 100644
--- a/spec/frontend/crm/contacts_root_spec.js
+++ b/spec/frontend/crm/contacts_root_spec.js
@@ -122,16 +122,6 @@ describe('Customer relations contacts root app', () => {
expect(findError().exists()).toBe(true);
});
-
- it('should exist when new contact form emits error', async () => {
- router.replace({ path: '/new' });
- mountComponent();
-
- findNewContactForm().vm.$emit('error');
- await waitForPromises();
-
- expect(findError().exists()).toBe(true);
- });
});
describe('on successful load', () => {
diff --git a/spec/frontend/crm/new_contact_form_spec.js b/spec/frontend/crm/new_contact_form_spec.js
index 681c0539536..1497c348676 100644
--- a/spec/frontend/crm/new_contact_form_spec.js
+++ b/spec/frontend/crm/new_contact_form_spec.js
@@ -1,3 +1,4 @@
+import { GlAlert } from '@gitlab/ui';
import Vue from 'vue';
import VueApollo from 'vue-apollo';
import { shallowMountExtended } from 'helpers/vue_test_utils_helper';
@@ -21,6 +22,7 @@ describe('Customer relations contacts root app', () => {
const findCreateNewContactButton = () => wrapper.findByTestId('create-new-contact-button');
const findCancelButton = () => wrapper.findByTestId('cancel-button');
const findForm = () => wrapper.find('form');
+ const findError = () => wrapper.findComponent(GlAlert);
const mountComponent = ({ mountFunction = shallowMountExtended } = {}) => {
fakeApollo = createMockApollo([[createContactMutation, queryHandler]]);
@@ -32,6 +34,7 @@ describe('Customer relations contacts root app', () => {
wrapper = mountFunction(NewContactForm, {
provide: { groupId: 26, groupFullPath: 'flightjs' },
apolloProvider: fakeApollo,
+ propsData: { drawerOpen: true },
});
};
@@ -83,26 +86,25 @@ describe('Customer relations contacts root app', () => {
});
describe('when query fails', () => {
- it('should emit error on reject', async () => {
+ it('should show error on reject', async () => {
queryHandler = jest.fn().mockRejectedValue('ERROR');
mountComponent();
findForm().trigger('submit');
await waitForPromises();
- expect(wrapper.emitted().error).toBeTruthy();
+ expect(findError().exists()).toBe(true);
});
- it('should emit error on error response', async () => {
+ it('should show error on error response', async () => {
queryHandler = jest.fn().mockResolvedValue(createContactMutationErrorResponse);
mountComponent();
findForm().trigger('submit');
await waitForPromises();
- expect(wrapper.emitted().error[0][0]).toEqual(
- createContactMutationErrorResponse.data.customerRelationsContactCreate.errors,
- );
+ expect(findError().exists()).toBe(true);
+ expect(findError().text()).toBe('Phone is invalid.');
});
});
});