1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
|
import { shallowMountExtended } from 'helpers/vue_test_utils_helper';
import ContributionEvents from '~/contribution_events/components/contribution_events.vue';
import ContributionEventApproved from '~/contribution_events/components/contribution_event/contribution_event_approved.vue';
import ContributionEventExpired from '~/contribution_events/components/contribution_event/contribution_event_expired.vue';
import ContributionEventJoined from '~/contribution_events/components/contribution_event/contribution_event_joined.vue';
import ContributionEventLeft from '~/contribution_events/components/contribution_event/contribution_event_left.vue';
import ContributionEventPushed from '~/contribution_events/components/contribution_event/contribution_event_pushed.vue';
import ContributionEventPrivate from '~/contribution_events/components/contribution_event/contribution_event_private.vue';
import ContributionEventMerged from '~/contribution_events/components/contribution_event/contribution_event_merged.vue';
import ContributionEventCreated from '~/contribution_events/components/contribution_event/contribution_event_created.vue';
import ContributionEventClosed from '~/contribution_events/components/contribution_event/contribution_event_closed.vue';
import ContributionEventReopened from '~/contribution_events/components/contribution_event/contribution_event_reopened.vue';
import ContributionEventCommented from '~/contribution_events/components/contribution_event/contribution_event_commented.vue';
import {
eventApproved,
eventExpired,
eventJoined,
eventLeft,
eventPushedBranch,
eventPrivate,
eventMerged,
eventCreated,
eventClosed,
eventReopened,
eventCommented,
} from '../utils';
describe('ContributionEvents', () => {
let wrapper;
const createComponent = () => {
wrapper = shallowMountExtended(ContributionEvents, {
propsData: {
events: [
eventApproved(),
eventExpired(),
eventJoined(),
eventLeft(),
eventPushedBranch(),
eventPrivate(),
eventMerged(),
eventCreated(),
eventClosed(),
eventReopened(),
eventCommented(),
],
},
});
};
it.each`
expectedComponent | expectedEvent
${ContributionEventApproved} | ${eventApproved()}
${ContributionEventExpired} | ${eventExpired()}
${ContributionEventJoined} | ${eventJoined()}
${ContributionEventLeft} | ${eventLeft()}
${ContributionEventPushed} | ${eventPushedBranch()}
${ContributionEventPrivate} | ${eventPrivate()}
${ContributionEventMerged} | ${eventMerged()}
${ContributionEventCreated} | ${eventCreated()}
${ContributionEventClosed} | ${eventClosed()}
${ContributionEventReopened} | ${eventReopened()}
${ContributionEventCommented} | ${eventCommented()}
`(
'renders `$expectedComponent.name` component and passes expected event',
({ expectedComponent, expectedEvent }) => {
createComponent();
expect(wrapper.findComponent(expectedComponent).props('event')).toEqual(expectedEvent);
},
);
});
|