debian-mirror-gitlab/spec/frontend/integrations/edit/components/sections/trigger_spec.js

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

35 lines
1.1 KiB
JavaScript
Raw Normal View History

2022-07-23 23:45:48 +05:30
import { shallowMount } from '@vue/test-utils';
import IntegrationSectionTrigger from '~/integrations/edit/components/sections/trigger.vue';
import TriggerField from '~/integrations/edit/components/trigger_field.vue';
import { createStore } from '~/integrations/edit/store';
import { mockIntegrationProps } from '../../mock_data';
describe('IntegrationSectionTrigger', () => {
let wrapper;
const createComponent = () => {
const store = createStore({
customState: { ...mockIntegrationProps },
});
wrapper = shallowMount(IntegrationSectionTrigger, {
store,
});
};
const findAllTriggerFields = () => wrapper.findAllComponents(TriggerField);
describe('template', () => {
it('renders correct number of TriggerField components', () => {
createComponent();
const fields = findAllTriggerFields();
expect(fields.length).toBe(mockIntegrationProps.triggerEvents.length);
fields.wrappers.forEach((field, index) => {
expect(field.props('event')).toBe(mockIntegrationProps.triggerEvents[index]);
});
});
});
});