diff options
Diffstat (limited to 'spec/frontend/boards/mock_data.js')
-rw-r--r-- | spec/frontend/boards/mock_data.js | 176 |
1 files changed, 165 insertions, 11 deletions
diff --git a/spec/frontend/boards/mock_data.js b/spec/frontend/boards/mock_data.js index 8ef6efe23c7..5776332c499 100644 --- a/spec/frontend/boards/mock_data.js +++ b/spec/frontend/boards/mock_data.js @@ -1,3 +1,9 @@ +/* global ListIssue */ +/* global List */ + +import Vue from 'vue'; +import '~/boards/models/list'; +import '~/boards/models/issue'; import boardsStore from '~/boards/stores/boards_store'; export const boardObj = { @@ -92,11 +98,64 @@ export const mockMilestone = { due_date: '2019-12-31', }; +const assignees = [ + { + id: 'gid://gitlab/User/2', + username: 'angelina.herman', + name: 'Bernardina Bosco', + avatar: 'https://www.gravatar.com/avatar/eb7b664b13a30ad9f9ba4b61d7075470?s=80&d=identicon', + webUrl: 'http://127.0.0.1:3000/angelina.herman', + }, +]; + +const labels = [ + { + id: 'gid://gitlab/GroupLabel/5', + title: 'Cosync', + color: '#34ebec', + description: null, + }, +]; + +export const rawIssue = { + title: 'Issue 1', + id: 'gid://gitlab/Issue/436', + iid: 27, + dueDate: null, + timeEstimate: 0, + weight: null, + confidential: false, + referencePath: 'gitlab-org/test-subgroup/gitlab-test#27', + path: '/gitlab-org/test-subgroup/gitlab-test/-/issues/27', + labels: { + nodes: [ + { + id: 1, + title: 'test', + color: 'red', + description: 'testing', + }, + ], + }, + assignees: { + nodes: assignees, + }, + epic: { + id: 'gid://gitlab/Epic/41', + }, +}; + export const mockIssue = { - title: 'Testing', - id: 1, - iid: 1, + id: 'gid://gitlab/Issue/436', + iid: 27, + title: 'Issue 1', + dueDate: null, + timeEstimate: 0, + weight: null, confidential: false, + referencePath: 'gitlab-org/test-subgroup/gitlab-test#27', + path: '/gitlab-org/test-subgroup/gitlab-test/-/issues/27', + assignees, labels: [ { id: 1, @@ -105,16 +164,64 @@ export const mockIssue = { description: 'testing', }, ], - assignees: [ - { - id: 1, - name: 'name', - username: 'username', - avatar_url: 'http://avatar_url', - }, - ], + epic: { + id: 'gid://gitlab/Epic/41', + }, }; +export const mockIssueWithModel = new ListIssue(mockIssue); + +export const mockIssue2 = { + id: 'gid://gitlab/Issue/437', + iid: 28, + title: 'Issue 2', + dueDate: null, + timeEstimate: 0, + weight: null, + confidential: false, + referencePath: 'gitlab-org/test-subgroup/gitlab-test#28', + path: '/gitlab-org/test-subgroup/gitlab-test/-/issues/28', + assignees, + labels, + epic: { + id: 'gid://gitlab/Epic/40', + }, +}; + +export const mockIssue2WithModel = new ListIssue(mockIssue2); + +export const mockIssue3 = { + id: 'gid://gitlab/Issue/438', + iid: 29, + title: 'Issue 3', + referencePath: '#29', + dueDate: null, + timeEstimate: 0, + weight: null, + confidential: false, + path: '/gitlab-org/gitlab-test/-/issues/28', + assignees, + labels, + epic: null, +}; + +export const mockIssue4 = { + id: 'gid://gitlab/Issue/439', + iid: 30, + title: 'Issue 4', + referencePath: '#30', + dueDate: null, + timeEstimate: 0, + weight: null, + confidential: false, + path: '/gitlab-org/gitlab-test/-/issues/28', + assignees, + labels, + epic: null, +}; + +export const mockIssues = [mockIssue, mockIssue2]; + export const BoardsMockData = { GET: { '/test/-/boards/1/lists/300/issues?id=300&page=1': { @@ -165,3 +272,50 @@ export const setMockEndpoints = (opts = {}) => { boardId, }); }; + +export const mockLists = [ + { + id: 'gid://gitlab/List/1', + title: 'Backlog', + position: null, + listType: 'backlog', + collapsed: false, + label: null, + assignee: null, + milestone: null, + loading: false, + }, + { + id: 'gid://gitlab/List/2', + title: 'To Do', + position: 0, + listType: 'label', + collapsed: false, + label: { + id: 'gid://gitlab/GroupLabel/121', + title: 'To Do', + color: '#F0AD4E', + textColor: '#FFFFFF', + description: null, + }, + assignee: null, + milestone: null, + loading: false, + }, +]; + +export const mockListsWithModel = mockLists.map(listMock => + Vue.observable(new List({ ...listMock, doNotFetchIssues: true })), +); + +export const mockIssuesByListId = { + 'gid://gitlab/List/1': [mockIssue.id, mockIssue3.id, mockIssue4.id], + 'gid://gitlab/List/2': mockIssues.map(({ id }) => id), +}; + +export const issues = { + [mockIssue.id]: mockIssue, + [mockIssue2.id]: mockIssue2, + [mockIssue3.id]: mockIssue3, + [mockIssue4.id]: mockIssue4, +}; |