Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'spec/frontend/work_items/mock_data.js')
-rw-r--r--spec/frontend/work_items/mock_data.js292
1 files changed, 288 insertions, 4 deletions
diff --git a/spec/frontend/work_items/mock_data.js b/spec/frontend/work_items/mock_data.js
index bf3f4e1364d..0359caf7116 100644
--- a/spec/frontend/work_items/mock_data.js
+++ b/spec/frontend/work_items/mock_data.js
@@ -1,3 +1,22 @@
+export const mockAssignees = [
+ {
+ __typename: 'UserCore',
+ id: 'gid://gitlab/User/1',
+ avatarUrl: '',
+ webUrl: '',
+ name: 'John Doe',
+ username: 'doe_I',
+ },
+ {
+ __typename: 'UserCore',
+ id: 'gid://gitlab/User/2',
+ avatarUrl: '',
+ webUrl: '',
+ name: 'Marcus Rutherford',
+ username: 'ruthfull',
+ },
+];
+
export const workItemQueryResponse = {
data: {
workItem: {
@@ -23,6 +42,32 @@ export const workItemQueryResponse = {
descriptionHtml:
'<p data-sourcepos="1:1-1:19" dir="auto">some <strong>great</strong> text</p>',
},
+ {
+ __typename: 'WorkItemWidgetAssignees',
+ type: 'ASSIGNEES',
+ allowsMultipleAssignees: true,
+ assignees: {
+ nodes: mockAssignees,
+ },
+ },
+ {
+ __typename: 'WorkItemWidgetHierarchy',
+ type: 'HIERARCHY',
+ parent: {
+ id: 'gid://gitlab/Issue/1',
+ iid: '5',
+ title: 'Parent title',
+ },
+ children: {
+ edges: [
+ {
+ node: {
+ id: 'gid://gitlab/WorkItem/444',
+ },
+ },
+ ],
+ },
+ },
],
},
},
@@ -47,13 +92,28 @@ export const updateWorkItemMutationResponse = {
deleteWorkItem: false,
updateWorkItem: false,
},
- widgets: [],
+ widgets: [
+ {
+ children: {
+ edges: [
+ {
+ node: 'gid://gitlab/WorkItem/444',
+ },
+ ],
+ },
+ },
+ ],
},
},
},
};
-export const workItemResponseFactory = ({ canUpdate } = {}) => ({
+export const workItemResponseFactory = ({
+ canUpdate = false,
+ allowsMultipleAssignees = true,
+ assigneesWidgetPresent = true,
+ parent = null,
+} = {}) => ({
data: {
workItem: {
__typename: 'WorkItem',
@@ -78,6 +138,30 @@ export const workItemResponseFactory = ({ canUpdate } = {}) => ({
descriptionHtml:
'<p data-sourcepos="1:1-1:19" dir="auto">some <strong>great</strong> text</p>',
},
+ assigneesWidgetPresent
+ ? {
+ __typename: 'WorkItemWidgetAssignees',
+ type: 'ASSIGNEES',
+ allowsMultipleAssignees,
+ assignees: {
+ nodes: mockAssignees,
+ },
+ }
+ : { type: 'MOCK TYPE' },
+ {
+ __typename: 'WorkItemWidgetHierarchy',
+ type: 'HIERARCHY',
+ children: {
+ edges: [
+ {
+ node: {
+ id: 'gid://gitlab/WorkItem/444',
+ },
+ },
+ ],
+ },
+ parent,
+ },
],
},
},
@@ -140,13 +224,45 @@ export const createWorkItemFromTaskMutationResponse = {
__typename: 'WorkItemCreateFromTaskPayload',
errors: [],
workItem: {
- descriptionHtml: '<p>New description</p>',
- id: 'gid://gitlab/WorkItem/13',
__typename: 'WorkItem',
+ description: 'New description',
+ id: 'gid://gitlab/WorkItem/1',
+ title: 'Updated title',
+ state: 'OPEN',
+ workItemType: {
+ __typename: 'WorkItemType',
+ id: 'gid://gitlab/WorkItems::Type/5',
+ name: 'Task',
+ },
userPermissions: {
deleteWorkItem: false,
updateWorkItem: false,
},
+ widgets: [
+ {
+ __typename: 'WorkItemWidgetDescription',
+ type: 'DESCRIPTION',
+ description: 'New description',
+ descriptionHtml: '<p>New description</p>',
+ },
+ ],
+ },
+ newWorkItem: {
+ __typename: 'WorkItem',
+ id: 'gid://gitlab/WorkItem/1000000',
+ title: 'Updated title',
+ state: 'OPEN',
+ description: '',
+ workItemType: {
+ __typename: 'WorkItemType',
+ id: 'gid://gitlab/WorkItems::Type/5',
+ name: 'Task',
+ },
+ userPermissions: {
+ deleteWorkItem: false,
+ updateWorkItem: false,
+ },
+ widgets: [],
},
},
},
@@ -275,3 +391,171 @@ export const workItemHierarchyResponse = {
},
},
};
+
+export const changeWorkItemParentMutationResponse = {
+ data: {
+ workItemUpdate: {
+ workItem: {
+ id: 'gid://gitlab/WorkItem/2',
+ workItemType: {
+ id: 'gid://gitlab/WorkItems::Type/5',
+ __typename: 'WorkItemType',
+ },
+ title: 'Foo',
+ state: 'OPEN',
+ __typename: 'WorkItem',
+ },
+ errors: [],
+ __typename: 'WorkItemUpdatePayload',
+ },
+ },
+};
+
+export const availableWorkItemsResponse = {
+ data: {
+ workspace: {
+ __typename: 'Project',
+ id: 'gid://gitlab/Project/2',
+ workItems: {
+ edges: [
+ {
+ node: {
+ id: 'gid://gitlab/WorkItem/458',
+ title: 'Task 1',
+ state: 'OPEN',
+ },
+ },
+ {
+ node: {
+ id: 'gid://gitlab/WorkItem/459',
+ title: 'Task 2',
+ state: 'OPEN',
+ },
+ },
+ ],
+ },
+ },
+ },
+};
+
+export const projectMembersResponseWithCurrentUser = {
+ data: {
+ workspace: {
+ id: '1',
+ __typename: 'Project',
+ users: {
+ nodes: [
+ {
+ id: 'user-2',
+ user: {
+ __typename: 'UserCore',
+ id: 'gid://gitlab/User/5',
+ avatarUrl: '/avatar2',
+ name: 'rookie',
+ username: 'rookie',
+ webUrl: 'rookie',
+ status: null,
+ },
+ },
+ {
+ id: 'user-1',
+ user: {
+ __typename: 'UserCore',
+ id: 'gid://gitlab/User/1',
+ avatarUrl:
+ 'https://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80\u0026d=identicon',
+ name: 'Administrator',
+ username: 'root',
+ webUrl: '/root',
+ status: null,
+ },
+ },
+ ],
+ },
+ },
+ },
+};
+
+export const projectMembersResponseWithoutCurrentUser = {
+ data: {
+ workspace: {
+ id: '1',
+ __typename: 'Project',
+ users: {
+ nodes: [
+ {
+ id: 'user-2',
+ user: {
+ __typename: 'UserCore',
+ id: 'gid://gitlab/User/5',
+ avatarUrl: '/avatar2',
+ name: 'rookie',
+ username: 'rookie',
+ webUrl: 'rookie',
+ status: null,
+ },
+ },
+ ],
+ },
+ },
+ },
+};
+
+export const currentUserResponse = {
+ data: {
+ currentUser: {
+ __typename: 'UserCore',
+ id: 'gid://gitlab/User/1',
+ avatarUrl:
+ 'https://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80\u0026d=identicon',
+ name: 'Administrator',
+ username: 'root',
+ webUrl: '/root',
+ },
+ },
+};
+
+export const currentUserNullResponse = {
+ data: {
+ currentUser: null,
+ },
+};
+
+export const mockLabels = [
+ {
+ __typename: 'Label',
+ id: 'gid://gitlab/Label/1',
+ title: 'Label 1',
+ description: '',
+ color: '#f00',
+ textColor: '#00f',
+ },
+ {
+ __typename: 'Label',
+ id: 'gid://gitlab/Label/2',
+ title: 'Label 2',
+ description: '',
+ color: '#b00',
+ textColor: '#00b',
+ },
+];
+
+export const projectLabelsResponse = {
+ data: {
+ workspace: {
+ id: '1',
+ __typename: 'Project',
+ labels: {
+ nodes: mockLabels,
+ },
+ },
+ },
+};
+
+export const mockParent = {
+ parent: {
+ id: 'gid://gitlab/Issue/1',
+ iid: '5',
+ title: 'Parent title',
+ },
+};