diff options
Diffstat (limited to 'spec/frontend/contribution_events/components/contribution_event/contribution_event_approved_spec.js')
-rw-r--r-- | spec/frontend/contribution_events/components/contribution_event/contribution_event_approved_spec.js | 34 |
1 files changed, 9 insertions, 25 deletions
diff --git a/spec/frontend/contribution_events/components/contribution_event/contribution_event_approved_spec.js b/spec/frontend/contribution_events/components/contribution_event/contribution_event_approved_spec.js index 6672d3eb18b..5bce0ca3746 100644 --- a/spec/frontend/contribution_events/components/contribution_event/contribution_event_approved_spec.js +++ b/spec/frontend/contribution_events/components/contribution_event/contribution_event_approved_spec.js @@ -1,21 +1,18 @@ -import events from 'test_fixtures/controller/users/activity.json'; -import { mountExtended } from 'helpers/vue_test_utils_helper'; -import { EVENT_TYPE_APPROVED } from '~/contribution_events/constants'; +import { shallowMountExtended } from 'helpers/vue_test_utils_helper'; import ContributionEventApproved from '~/contribution_events/components/contribution_event/contribution_event_approved.vue'; import ContributionEventBase from '~/contribution_events/components/contribution_event/contribution_event_base.vue'; -import TargetLink from '~/contribution_events/components/target_link.vue'; -import ResourceParentLink from '~/contribution_events/components/resource_parent_link.vue'; +import { eventApproved } from '../../utils'; -const eventApproved = events.find((event) => event.action === EVENT_TYPE_APPROVED); +const defaultPropsData = { + event: eventApproved(), +}; describe('ContributionEventApproved', () => { let wrapper; const createComponent = () => { - wrapper = mountExtended(ContributionEventApproved, { - propsData: { - event: eventApproved, - }, + wrapper = shallowMountExtended(ContributionEventApproved, { + propsData: defaultPropsData, }); }; @@ -25,23 +22,10 @@ describe('ContributionEventApproved', () => { it('renders `ContributionEventBase`', () => { expect(wrapper.findComponent(ContributionEventBase).props()).toEqual({ - event: eventApproved, + event: defaultPropsData.event, iconName: 'approval-solid', iconClass: 'gl-text-green-500', + message: ContributionEventApproved.i18n.message, }); }); - - it('renders message', () => { - expect(wrapper.findByTestId('event-body').text()).toBe( - `Approved merge request ${eventApproved.target.reference_link_text} in ${eventApproved.resource_parent.full_name}.`, - ); - }); - - it('renders target link', () => { - expect(wrapper.findComponent(TargetLink).props('event')).toEqual(eventApproved); - }); - - it('renders resource parent link', () => { - expect(wrapper.findComponent(ResourceParentLink).props('event')).toEqual(eventApproved); - }); }); |