Не подтверждена Коммит 15521afb создал по автору Artur Fedorov's avatar Artur Fedorov
Просмотр файлов

This MR removes direct data manipulation

As part of Vue 3 migration
overriding method behavior and
direct data manipulation
should be avoided
владелец 48b9dae0
......@@ -2,7 +2,9 @@ import { GlButton, GlPopover } from '@gitlab/ui';
import { shallowMount } from '@vue/test-utils';
import { redirectTo } from '~/lib/utils/url_utility'; // eslint-disable-line import/no-deprecated
import { mockTracking, unmockTracking } from 'helpers/tracking_helper';
import { stubComponent } from 'helpers/stub_component';
import Verification from 'ee/registrations/verification/components/verification.vue';
import Zuora from 'ee/billings/components/zuora.vue';
import {
IFRAME_MINIMUM_HEIGHT,
EVENT_LABEL,
......@@ -16,7 +18,7 @@ jest.mock('~/lib/utils/url_utility');
describe('Verification', () => {
let wrapper;
let trackingSpy;
let zuoraSubmitSpy;
const zuoraSubmitSpy = jest.fn();
const NEXT_STEP_URL = 'https://gitlab.com/next-step';
const IFRAME_URL = 'https://customers.gitlab.com/payment_forms/cc_registration_validation';
......@@ -30,6 +32,11 @@ describe('Verification', () => {
stubs: {
GlButton,
GlPopover,
Zuora: stubComponent(Zuora, {
methods: {
submit: zuoraSubmitSpy,
},
}),
},
});
};
......@@ -68,18 +75,16 @@ describe('Verification', () => {
it('renders the Zuora component with the right attributes', () => {
expect(findZuora().exists()).toBe(true);
expect(findZuora().attributes()).toMatchObject({
iframeurl: IFRAME_URL,
allowedorigin: ALLOWED_ORIGIN,
initialheight: IFRAME_MINIMUM_HEIGHT.toString(),
expect(findZuora().props()).toMatchObject({
iframeUrl: IFRAME_URL,
allowedOrigin: ALLOWED_ORIGIN,
initialHeight: IFRAME_MINIMUM_HEIGHT,
});
});
});
describe('when the submit button is clicked', () => {
beforeEach(() => {
zuoraSubmitSpy = jest.fn();
wrapper.vm.$refs.zuora = { submit: zuoraSubmitSpy };
findSubmitButton().trigger('click');
});
......
Поддерживает Markdown
0% или .
You are about to add 0 people to the discussion. Proceed with caution.
Сначала завершите редактирование этого сообщения!
Пожалуйста, зарегистрируйтесь или чтобы прокомментировать