summaryrefslogtreecommitdiff
path: root/spec/frontend/issues/show/components/incidents/mock_data.js
blob: afc6099caf4a6a9f9b87ec8f84dff8dfde849445 (plain)
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
export const mockEvents = [
  {
    action: 'comment',
    author: {
      __typename: 'UserCore',
      id: 'gid://gitlab/User/1',
      name: 'Administrator',
      username: 'root',
    },
    createdAt: '2022-03-22T15:59:08Z',
    id: 'gid://gitlab/IncidentManagement::TimelineEvent/132',
    note: 'Dummy event 1',
    noteHtml: '<p>Dummy event 1</p>',
    occurredAt: '2022-03-22T15:59:00Z',
    updatedAt: '2022-03-22T15:59:08Z',
    __typename: 'TimelineEventType',
  },
  {
    action: 'comment',
    author: {
      __typename: 'UserCore',
      id: 'gid://gitlab/User/1',
      name: 'Administrator',
      username: 'root',
    },
    createdAt: '2022-03-23T14:57:08Z',
    id: 'gid://gitlab/IncidentManagement::TimelineEvent/131',
    note: 'Dummy event 2',
    noteHtml: '<p>Dummy event 2</p>',
    occurredAt: '2022-03-23T14:57:00Z',
    updatedAt: '2022-03-23T14:57:08Z',
    __typename: 'TimelineEventType',
  },
  {
    action: 'comment',
    author: {
      __typename: 'UserCore',
      id: 'gid://gitlab/User/1',
      name: 'Administrator',
      username: 'root',
    },
    createdAt: '2022-03-23T15:59:08Z',
    id: 'gid://gitlab/IncidentManagement::TimelineEvent/132',
    note: 'Dummy event 3',
    noteHtml: '<p>Dummy event 3</p>',
    occurredAt: '2022-03-23T15:59:00Z',
    updatedAt: '2022-03-23T15:59:08Z',
    __typename: 'TimelineEventType',
  },
];

export const timelineEventsQueryListResponse = {
  data: {
    project: {
      id: 'gid://gitlab/Project/8',
      incidentManagementTimelineEvents: {
        nodes: mockEvents,
      },
    },
  },
};

export const timelineEventsQueryEmptyResponse = {
  data: {
    project: {
      id: 'gid://gitlab/Project/8',
      incidentManagementTimelineEvents: {
        nodes: [],
      },
    },
  },
};

export const timelineEventsCreateEventResponse = {
  timelineEvent: {
    ...mockEvents[0],
  },
  errors: [],
};

export const timelineEventsCreateEventError = {
  data: {
    timelineEventCreate: {
      timelineEvent: {
        ...mockEvents[0],
      },
      errors: ['Create error'],
    },
  },
};

const timelineEventDeleteData = (errors = []) => {
  return {
    data: {
      timelineEventDestroy: {
        timelineEvent: { ...mockEvents[0] },
        errors,
      },
    },
  };
};

export const timelineEventsDeleteEventResponse = timelineEventDeleteData();

export const timelineEventsDeleteEventError = timelineEventDeleteData(['Item does not exist']);