2020-09-10 05:08:27 -04:00
|
|
|
/* global ListIssue */
|
|
|
|
/* global List */
|
|
|
|
|
2020-08-24 02:10:15 -04:00
|
|
|
import Vue from 'vue';
|
2020-09-10 05:08:27 -04:00
|
|
|
import '~/boards/models/list';
|
|
|
|
import '~/boards/models/issue';
|
2020-03-23 23:09:28 -04:00
|
|
|
import boardsStore from '~/boards/stores/boards_store';
|
|
|
|
|
2019-12-13 10:08:02 -05:00
|
|
|
export const boardObj = {
|
|
|
|
id: 1,
|
|
|
|
name: 'test',
|
|
|
|
milestone_id: null,
|
|
|
|
};
|
|
|
|
|
|
|
|
export const listObj = {
|
|
|
|
id: 300,
|
|
|
|
position: 0,
|
|
|
|
title: 'Test',
|
|
|
|
list_type: 'label',
|
|
|
|
weight: 3,
|
|
|
|
label: {
|
|
|
|
id: 5000,
|
|
|
|
title: 'Test',
|
2020-04-02 14:08:11 -04:00
|
|
|
color: '#ff0000',
|
2019-12-13 10:08:02 -05:00
|
|
|
description: 'testing;',
|
|
|
|
textColor: 'white',
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
export const listObjDuplicate = {
|
|
|
|
id: listObj.id,
|
|
|
|
position: 1,
|
|
|
|
title: 'Test',
|
|
|
|
list_type: 'label',
|
|
|
|
weight: 3,
|
|
|
|
label: {
|
|
|
|
id: listObj.label.id,
|
|
|
|
title: 'Test',
|
2020-04-02 14:08:11 -04:00
|
|
|
color: '#ff0000',
|
2019-12-13 10:08:02 -05:00
|
|
|
description: 'testing;',
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
export const mockAssigneesList = [
|
|
|
|
{
|
|
|
|
id: 2,
|
|
|
|
name: 'Terrell Graham',
|
|
|
|
username: 'monserrate.gleichner',
|
|
|
|
state: 'active',
|
|
|
|
avatar_url: 'https://www.gravatar.com/avatar/598fd02741ac58b88854a99d16704309?s=80&d=identicon',
|
|
|
|
web_url: 'http://127.0.0.1:3001/monserrate.gleichner',
|
|
|
|
path: '/monserrate.gleichner',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
id: 12,
|
|
|
|
name: 'Susy Johnson',
|
|
|
|
username: 'tana_harvey',
|
|
|
|
state: 'active',
|
|
|
|
avatar_url: 'https://www.gravatar.com/avatar/e021a7b0f3e4ae53b5068d487e68c031?s=80&d=identicon',
|
|
|
|
web_url: 'http://127.0.0.1:3001/tana_harvey',
|
|
|
|
path: '/tana_harvey',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
id: 20,
|
|
|
|
name: 'Conchita Eichmann',
|
|
|
|
username: 'juliana_gulgowski',
|
|
|
|
state: 'active',
|
|
|
|
avatar_url: 'https://www.gravatar.com/avatar/c43c506cb6fd7b37017d3b54b94aa937?s=80&d=identicon',
|
|
|
|
web_url: 'http://127.0.0.1:3001/juliana_gulgowski',
|
|
|
|
path: '/juliana_gulgowski',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
id: 6,
|
|
|
|
name: 'Bryce Turcotte',
|
|
|
|
username: 'melynda',
|
|
|
|
state: 'active',
|
|
|
|
avatar_url: 'https://www.gravatar.com/avatar/cc2518f2c6f19f8fac49e1a5ee092a9b?s=80&d=identicon',
|
|
|
|
web_url: 'http://127.0.0.1:3001/melynda',
|
|
|
|
path: '/melynda',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
id: 1,
|
|
|
|
name: 'Administrator',
|
|
|
|
username: 'root',
|
|
|
|
state: 'active',
|
|
|
|
avatar_url: 'https://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon',
|
|
|
|
web_url: 'http://127.0.0.1:3001/root',
|
|
|
|
path: '/root',
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
export const mockMilestone = {
|
|
|
|
id: 1,
|
|
|
|
state: 'active',
|
|
|
|
title: 'Milestone title',
|
|
|
|
description: 'Harum corporis aut consequatur quae dolorem error sequi quia.',
|
|
|
|
start_date: '2018-01-01',
|
|
|
|
due_date: '2019-12-31',
|
|
|
|
};
|
2020-03-23 23:09:28 -04:00
|
|
|
|
2020-09-14 05:09:34 -04:00
|
|
|
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,
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
2020-09-10 05:08:27 -04:00
|
|
|
export const rawIssue = {
|
2020-09-14 05:09:34 -04:00
|
|
|
title: 'Issue 1',
|
|
|
|
id: 'gid://gitlab/Issue/436',
|
|
|
|
iid: 27,
|
|
|
|
dueDate: null,
|
|
|
|
timeEstimate: 0,
|
|
|
|
weight: null,
|
2020-09-10 05:08:27 -04:00
|
|
|
confidential: false,
|
2020-09-14 05:09:34 -04:00
|
|
|
referencePath: 'gitlab-org/gitlab-test#27',
|
|
|
|
path: '/gitlab-org/gitlab-test/-/issues/27',
|
2020-09-10 05:08:27 -04:00
|
|
|
labels: {
|
|
|
|
nodes: [
|
|
|
|
{
|
|
|
|
id: 1,
|
|
|
|
title: 'test',
|
|
|
|
color: 'red',
|
|
|
|
description: 'testing',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
assignees: {
|
2020-09-14 05:09:34 -04:00
|
|
|
nodes: assignees,
|
|
|
|
},
|
|
|
|
epic: {
|
|
|
|
id: 'gid://gitlab/Epic/41',
|
2020-09-10 05:08:27 -04:00
|
|
|
},
|
|
|
|
};
|
|
|
|
|
2020-08-13 05:10:09 -04:00
|
|
|
export const mockIssue = {
|
2020-09-14 05:09:34 -04:00
|
|
|
id: 'gid://gitlab/Issue/436',
|
|
|
|
iid: 27,
|
|
|
|
title: 'Issue 1',
|
|
|
|
dueDate: null,
|
|
|
|
timeEstimate: 0,
|
|
|
|
weight: null,
|
2020-08-13 05:10:09 -04:00
|
|
|
confidential: false,
|
2020-09-14 05:09:34 -04:00
|
|
|
referencePath: 'gitlab-org/gitlab-test#27',
|
|
|
|
path: '/gitlab-org/gitlab-test/-/issues/27',
|
|
|
|
assignees,
|
2020-08-13 05:10:09 -04:00
|
|
|
labels: [
|
|
|
|
{
|
|
|
|
id: 1,
|
|
|
|
title: 'test',
|
|
|
|
color: 'red',
|
|
|
|
description: 'testing',
|
|
|
|
},
|
|
|
|
],
|
2020-09-14 05:09:34 -04:00
|
|
|
epic: {
|
|
|
|
id: 'gid://gitlab/Epic/41',
|
|
|
|
},
|
2020-08-13 05:10:09 -04:00
|
|
|
};
|
|
|
|
|
2020-09-10 05:08:27 -04:00
|
|
|
export const mockIssueWithModel = new ListIssue(mockIssue);
|
|
|
|
|
2020-09-09 17:08:33 -04:00
|
|
|
export const mockIssue2 = {
|
2020-09-14 05:09:34 -04:00
|
|
|
id: 'gid://gitlab/Issue/437',
|
|
|
|
iid: 28,
|
|
|
|
title: 'Issue 2',
|
|
|
|
dueDate: null,
|
|
|
|
timeEstimate: 0,
|
|
|
|
weight: null,
|
2020-09-09 17:08:33 -04:00
|
|
|
confidential: false,
|
2020-09-10 05:08:27 -04:00
|
|
|
referencePath: 'gitlab-org/gitlab-test#2',
|
2020-09-14 05:09:34 -04:00
|
|
|
path: '/gitlab-org/gitlab-test/-/issues/28',
|
|
|
|
assignees,
|
|
|
|
labels,
|
|
|
|
epic: {
|
|
|
|
id: 'gid://gitlab/Epic/40',
|
|
|
|
},
|
2020-09-09 17:08:33 -04:00
|
|
|
};
|
|
|
|
|
2020-09-10 05:08:27 -04:00
|
|
|
export const mockIssue2WithModel = new ListIssue(mockIssue2);
|
|
|
|
|
2020-09-14 05:09:34 -04:00
|
|
|
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];
|
|
|
|
|
2020-03-23 23:09:28 -04:00
|
|
|
export const BoardsMockData = {
|
|
|
|
GET: {
|
|
|
|
'/test/-/boards/1/lists/300/issues?id=300&page=1': {
|
|
|
|
issues: [
|
|
|
|
{
|
|
|
|
title: 'Testing',
|
|
|
|
id: 1,
|
|
|
|
iid: 1,
|
|
|
|
confidential: false,
|
|
|
|
labels: [],
|
|
|
|
assignees: [],
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
'/test/issue-boards/-/milestones.json': [
|
|
|
|
{
|
|
|
|
id: 1,
|
|
|
|
title: 'test',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
POST: {
|
|
|
|
'/test/-/boards/1/lists': listObj,
|
|
|
|
},
|
|
|
|
PUT: {
|
|
|
|
'/test/issue-boards/-/board/1/lists{/id}': {},
|
|
|
|
},
|
|
|
|
DELETE: {
|
|
|
|
'/test/issue-boards/-/board/1/lists{/id}': {},
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
export const boardsMockInterceptor = config => {
|
|
|
|
const body = BoardsMockData[config.method.toUpperCase()][config.url];
|
|
|
|
return [200, body];
|
|
|
|
};
|
|
|
|
|
|
|
|
export const setMockEndpoints = (opts = {}) => {
|
|
|
|
const boardsEndpoint = opts.boardsEndpoint || '/test/issue-boards/-/boards.json';
|
|
|
|
const listsEndpoint = opts.listsEndpoint || '/test/-/boards/1/lists';
|
|
|
|
const bulkUpdatePath = opts.bulkUpdatePath || '';
|
|
|
|
const boardId = opts.boardId || '1';
|
|
|
|
|
|
|
|
boardsStore.setEndpoints({
|
|
|
|
boardsEndpoint,
|
|
|
|
listsEndpoint,
|
|
|
|
bulkUpdatePath,
|
|
|
|
boardId,
|
|
|
|
});
|
|
|
|
};
|
2020-08-24 02:10:15 -04:00
|
|
|
|
|
|
|
export const mockLists = [
|
|
|
|
{
|
|
|
|
id: 'gid://gitlab/List/1',
|
|
|
|
title: 'Backlog',
|
|
|
|
position: null,
|
|
|
|
listType: 'backlog',
|
|
|
|
collapsed: false,
|
|
|
|
label: null,
|
|
|
|
assignee: null,
|
|
|
|
milestone: null,
|
2020-09-14 05:09:34 -04:00
|
|
|
loading: false,
|
2020-08-24 02:10:15 -04:00
|
|
|
},
|
|
|
|
{
|
|
|
|
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,
|
2020-09-14 05:09:34 -04:00
|
|
|
loading: false,
|
2020-08-24 02:10:15 -04:00
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
export const mockListsWithModel = mockLists.map(listMock =>
|
|
|
|
Vue.observable(new List({ ...listMock, doNotFetchIssues: true })),
|
|
|
|
);
|
2020-09-14 05:09:34 -04:00
|
|
|
|
|
|
|
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,
|
|
|
|
};
|