diff options
Diffstat (limited to 'spec/frontend/work_items/mock_data.js')
-rw-r--r-- | spec/frontend/work_items/mock_data.js | 192 |
1 files changed, 163 insertions, 29 deletions
diff --git a/spec/frontend/work_items/mock_data.js b/spec/frontend/work_items/mock_data.js index 05e83c0df3d..ba244b19eb5 100644 --- a/spec/frontend/work_items/mock_data.js +++ b/spec/frontend/work_items/mock_data.js @@ -1,3 +1,5 @@ +import { WIDGET_TYPE_LINKED_ITEMS } from '~/work_items/constants'; + export const mockAssignees = [ { __typename: 'UserCore', @@ -451,6 +453,126 @@ export const objectiveType = { iconName: 'issue-type-objective', }; +export const mockEmptyLinkedItems = { + type: WIDGET_TYPE_LINKED_ITEMS, + blocked: false, + blockedByCount: 0, + blockingCount: 0, + linkedItems: { + nodes: [], + __typename: 'LinkedWorkItemTypeConnection', + }, + __typename: 'WorkItemWidgetLinkedItems', +}; + +export const mockBlockingLinkedItem = { + type: WIDGET_TYPE_LINKED_ITEMS, + linkedItems: { + nodes: [ + { + linkId: 'gid://gitlab/WorkItems::RelatedWorkItemLink/8', + linkType: 'blocks', + workItem: { + id: 'gid://gitlab/WorkItem/675', + iid: '83', + confidential: true, + workItemType: { + id: 'gid://gitlab/WorkItems::Type/5', + name: 'Task', + iconName: 'issue-type-task', + __typename: 'WorkItemType', + }, + title: 'Task 1201', + state: 'OPEN', + createdAt: '2023-03-28T10:50:16Z', + closedAt: null, + widgets: [], + __typename: 'WorkItem', + }, + __typename: 'LinkedWorkItemType', + }, + ], + __typename: 'LinkedWorkItemTypeConnection', + }, + __typename: 'WorkItemWidgetLinkedItems', +}; + +export const mockLinkedItems = { + type: WIDGET_TYPE_LINKED_ITEMS, + linkedItems: { + nodes: [ + { + linkId: 'gid://gitlab/WorkItems::RelatedWorkItemLink/8', + linkType: 'relates_to', + workItem: { + id: 'gid://gitlab/WorkItem/675', + iid: '83', + confidential: true, + workItemType: { + id: 'gid://gitlab/WorkItems::Type/5', + name: 'Task', + iconName: 'issue-type-task', + __typename: 'WorkItemType', + }, + title: 'Task 1201', + state: 'OPEN', + createdAt: '2023-03-28T10:50:16Z', + closedAt: null, + widgets: [], + __typename: 'WorkItem', + }, + __typename: 'LinkedWorkItemType', + }, + { + linkId: 'gid://gitlab/WorkItems::RelatedWorkItemLink/9', + linkType: 'is_blocked_by', + workItem: { + id: 'gid://gitlab/WorkItem/646', + iid: '55', + confidential: true, + workItemType: { + id: 'gid://gitlab/WorkItems::Type/6', + name: 'Objective', + iconName: 'issue-type-objective', + __typename: 'WorkItemType', + }, + title: 'Multilevel Objective 1', + state: 'OPEN', + createdAt: '2023-03-28T10:50:16Z', + closedAt: null, + widgets: [], + __typename: 'WorkItem', + }, + __typename: 'LinkedWorkItemType', + }, + { + linkId: 'gid://gitlab/WorkItems::RelatedWorkItemLink/10', + linkType: 'blocks', + workItem: { + id: 'gid://gitlab/WorkItem/647', + iid: '56', + confidential: true, + workItemType: { + id: 'gid://gitlab/WorkItems::Type/6', + name: 'Objective', + iconName: 'issue-type-objective', + __typename: 'WorkItemType', + }, + title: 'Multilevel Objective 2', + state: 'OPEN', + createdAt: '2023-03-28T10:50:16Z', + closedAt: null, + widgets: [], + __typename: 'WorkItem', + }, + __typename: 'LinkedWorkItemType', + }, + ], + __typename: 'LinkedWorkItemTypeConnection', + }, + __typename: 'WorkItemWidgetLinkedItems', +}; + export const workItemResponseFactory = ({ iid = '1', canUpdate = false, @@ -473,6 +595,7 @@ export const workItemResponseFactory = ({ confidential = false, canInviteMembers = false, labelsWidgetPresent = true, + linkedItemsWidgetPresent = true, labels = mockLabels, allowsScopedLabels = false, lastEditedAt = null, @@ -485,6 +608,7 @@ export const workItemResponseFactory = ({ updatedAt = '2022-08-08T12:32:54Z', awardEmoji = mockAwardsWidget, state = 'OPEN', + linkedItems = mockEmptyLinkedItems, } = {}) => ({ data: { workItem: { @@ -683,6 +807,7 @@ export const workItemResponseFactory = ({ awardEmoji, } : { type: 'MOCK TYPE' }, + linkedItemsWidgetPresent ? linkedItems : { type: 'MOCK TYPE' }, ], }, }, @@ -1471,6 +1596,27 @@ export const availableWorkItemsResponse = { }, }; +export const searchedWorkItemsResponse = { + data: { + workspace: { + __typename: 'Project', + id: 'gid://gitlab/Project/2', + workItems: { + nodes: [ + { + id: 'gid://gitlab/WorkItem/459', + title: 'Task 2', + state: 'OPEN', + createdAt: '2022-08-03T12:41:54Z', + confidential: false, + __typename: 'WorkItem', + }, + ], + }, + }, + }, +}; + export const projectMembersResponseWithCurrentUser = { data: { workspace: { @@ -1883,8 +2029,7 @@ export const mockWorkItemNotesResponse = { systemNoteIconName: 'link', createdAt: '2022-11-14T04:18:59Z', lastEditedAt: null, - url: - 'http://127.0.0.1:3000/flightjs/Flight/-/work_items/37?iid_path=true#note_199', + url: 'http://127.0.0.1:3000/flightjs/Flight/-/work_items/37#note_199', lastEditedBy: null, system: true, internal: false, @@ -1934,8 +2079,7 @@ export const mockWorkItemNotesResponse = { systemNoteIconName: 'clock', createdAt: '2022-11-14T04:18:59Z', lastEditedAt: null, - url: - 'http://127.0.0.1:3000/flightjs/Flight/-/work_items/37?iid_path=true#note_201', + url: 'http://127.0.0.1:3000/flightjs/Flight/-/work_items/37#note_201', lastEditedBy: null, system: true, internal: false, @@ -1984,8 +2128,7 @@ export const mockWorkItemNotesResponse = { systemNoteIconName: 'weight', createdAt: '2022-11-25T07:16:20Z', lastEditedAt: null, - url: - 'http://127.0.0.1:3000/flightjs/Flight/-/work_items/37?iid_path=true#note_202', + url: 'http://127.0.0.1:3000/flightjs/Flight/-/work_items/37#note_202', lastEditedBy: null, system: true, internal: false, @@ -2097,8 +2240,7 @@ export const mockWorkItemNotesByIidResponse = { systemNoteIconName: 'link', createdAt: '2022-11-14T04:18:59Z', lastEditedAt: null, - url: - 'http://127.0.0.1:3000/flightjs/Flight/-/work_items/37?iid_path=true#note_191', + url: 'http://127.0.0.1:3000/flightjs/Flight/-/work_items/37#note_191', lastEditedBy: null, system: true, internal: false, @@ -2153,8 +2295,7 @@ export const mockWorkItemNotesByIidResponse = { systemNoteIconName: 'clock', createdAt: '2022-11-14T04:18:59Z', lastEditedAt: null, - url: - 'http://127.0.0.1:3000/flightjs/Flight/-/work_items/37?iid_path=true#note_191', + url: 'http://127.0.0.1:3000/flightjs/Flight/-/work_items/37#note_191', lastEditedBy: null, system: true, internal: false, @@ -2210,8 +2351,7 @@ export const mockWorkItemNotesByIidResponse = { systemNoteIconName: 'iteration', createdAt: '2022-11-14T04:19:00Z', lastEditedAt: null, - url: - 'http://127.0.0.1:3000/flightjs/Flight/-/work_items/37?iid_path=true#note_191', + url: 'http://127.0.0.1:3000/flightjs/Flight/-/work_items/37#note_191', lastEditedBy: null, system: true, internal: false, @@ -2325,8 +2465,7 @@ export const mockMoreWorkItemNotesResponse = { systemNoteIconName: 'link', createdAt: '2022-11-14T04:18:59Z', lastEditedAt: null, - url: - 'http://127.0.0.1:3000/flightjs/Flight/-/work_items/37?iid_path=true#note_191', + url: 'http://127.0.0.1:3000/flightjs/Flight/-/work_items/37#note_191', lastEditedBy: null, system: true, internal: false, @@ -2381,8 +2520,7 @@ export const mockMoreWorkItemNotesResponse = { systemNoteIconName: 'clock', createdAt: '2022-11-14T04:18:59Z', lastEditedAt: null, - url: - 'http://127.0.0.1:3000/flightjs/Flight/-/work_items/37?iid_path=true#note_191', + url: 'http://127.0.0.1:3000/flightjs/Flight/-/work_items/37#note_191', lastEditedBy: null, system: true, internal: false, @@ -2435,8 +2573,7 @@ export const mockMoreWorkItemNotesResponse = { systemNoteIconName: 'weight', createdAt: '2022-11-25T07:16:20Z', lastEditedAt: null, - url: - 'http://127.0.0.1:3000/flightjs/Flight/-/work_items/37?iid_path=true#note_191', + url: 'http://127.0.0.1:3000/flightjs/Flight/-/work_items/37#note_191', lastEditedBy: null, system: true, internal: false, @@ -2511,7 +2648,7 @@ export const createWorkItemNoteResponse = { systemNoteIconName: null, createdAt: '2023-01-25T04:49:46Z', lastEditedAt: null, - url: 'http://127.0.0.1:3000/flightjs/Flight/-/work_items/37?iid_path=true#note_191', + url: 'http://127.0.0.1:3000/flightjs/Flight/-/work_items/37#note_191', lastEditedBy: null, maxAccessLevelOfAuthor: 'Owner', authorIsContributor: false, @@ -2565,7 +2702,7 @@ export const mockWorkItemCommentNote = { systemNoteIconName: false, createdAt: '2022-11-25T07:16:20Z', lastEditedAt: null, - url: 'http://127.0.0.1:3000/flightjs/Flight/-/work_items/37?iid_path=true#note_191', + url: 'http://127.0.0.1:3000/flightjs/Flight/-/work_items/37#note_191', lastEditedBy: null, system: false, internal: false, @@ -2665,8 +2802,7 @@ export const mockWorkItemNotesResponseWithComments = { systemNoteIconName: null, createdAt: '2023-01-12T07:47:40Z', lastEditedAt: null, - url: - 'http://127.0.0.1:3000/flightjs/Flight/-/work_items/37?iid_path=true#note_191', + url: 'http://127.0.0.1:3000/flightjs/Flight/-/work_items/37#note_191', lastEditedBy: null, maxAccessLevelOfAuthor: 'Owner', authorIsContributor: false, @@ -2708,8 +2844,7 @@ export const mockWorkItemNotesResponseWithComments = { systemNoteIconName: null, createdAt: '2023-01-18T09:09:54Z', lastEditedAt: null, - url: - 'http://127.0.0.1:3000/flightjs/Flight/-/work_items/37?iid_path=true#note_191', + url: 'http://127.0.0.1:3000/flightjs/Flight/-/work_items/37#note_191', lastEditedBy: null, maxAccessLevelOfAuthor: 'Owner', authorIsContributor: false, @@ -2758,8 +2893,7 @@ export const mockWorkItemNotesResponseWithComments = { systemNoteIconName: 'weight', createdAt: '2022-11-25T07:16:20Z', lastEditedAt: null, - url: - 'http://127.0.0.1:3000/flightjs/Flight/-/work_items/37?iid_path=true#note_191', + url: 'http://127.0.0.1:3000/flightjs/Flight/-/work_items/37#note_191', lastEditedBy: null, system: false, internal: false, @@ -2821,7 +2955,7 @@ export const workItemNotesCreateSubscriptionResponse = { systemNoteIconName: 'weight', createdAt: '2022-11-25T07:16:20Z', lastEditedAt: null, - url: 'http://127.0.0.1:3000/flightjs/Flight/-/work_items/37?iid_path=true#note_191', + url: 'http://127.0.0.1:3000/flightjs/Flight/-/work_items/37#note_191', lastEditedBy: null, system: true, internal: false, @@ -2836,7 +2970,7 @@ export const workItemNotesCreateSubscriptionResponse = { systemNoteIconName: 'weight', createdAt: '2022-11-25T07:16:20Z', lastEditedAt: null, - url: 'http://127.0.0.1:3000/flightjs/Flight/-/work_items/37?iid_path=true#note_191', + url: 'http://127.0.0.1:3000/flightjs/Flight/-/work_items/37#note_191', lastEditedBy: null, system: true, internal: false, @@ -2914,7 +3048,7 @@ export const workItemNotesUpdateSubscriptionResponse = { systemNoteIconName: 'pencil', createdAt: '2022-11-25T07:16:20Z', lastEditedAt: null, - url: 'http://127.0.0.1:3000/flightjs/Flight/-/work_items/37?iid_path=true#note_191', + url: 'http://127.0.0.1:3000/flightjs/Flight/-/work_items/37#note_191', lastEditedBy: null, system: true, internal: false, |