gitlab-org--gitlab-foss/spec/javascripts/boards/mock_data.js

143 lines
3.3 KiB
JavaScript
Raw Normal View History

import BoardService from '~/boards/services/board_service';
export const boardObj = {
id: 1,
name: 'test',
milestone_id: null,
};
2017-12-15 03:31:14 -05:00
export const listObj = {
id: 300,
2016-08-10 08:54:04 -04:00
position: 0,
title: 'Test',
list_type: 'label',
label: {
2017-12-15 03:31:14 -05:00
id: 5000,
2016-08-10 08:54:04 -04:00
title: 'Testing',
color: 'red',
2018-03-29 13:55:53 -04:00
description: 'testing;',
2019-04-23 09:13:40 -04:00
textColor: 'white',
2018-03-29 13:55:53 -04:00
},
2016-08-10 08:54:04 -04:00
};
2017-12-15 03:31:14 -05:00
export const listObjDuplicate = {
id: listObj.id,
2016-08-10 08:54:04 -04:00
position: 1,
title: 'Test',
list_type: 'label',
label: {
id: listObj.label.id,
2016-08-10 08:54:04 -04:00
title: 'Testing',
color: 'red',
2018-03-29 13:55:53 -04:00
description: 'testing;',
},
2016-08-10 08:54:04 -04:00
};
2017-12-15 03:31:14 -05:00
export const BoardsMockData = {
2018-03-29 13:55:53 -04:00
GET: {
'/test/-/boards/1/lists/300/issues?id=300&page=1': {
2018-03-29 13:55:53 -04:00
issues: [
{
title: 'Testing',
id: 1,
iid: 1,
confidential: false,
labels: [],
assignees: [],
},
],
},
'/test/issue-boards/-/milestones.json': [
{
id: 1,
title: 'test',
},
],
2018-03-29 13:55:53 -04:00
},
POST: {
'/test/-/boards/1/lists': listObj,
2016-08-10 08:54:04 -04:00
},
2018-03-29 13:55:53 -04:00
PUT: {
'/test/issue-boards/-/board/1/lists{/id}': {},
2016-08-10 08:54:04 -04:00
},
2018-03-29 13:55:53 -04:00
DELETE: {
'/test/issue-boards/-/board/1/lists{/id}': {},
2016-08-10 08:54:04 -04:00
},
};
2018-03-29 13:55:53 -04:00
export const boardsMockInterceptor = config => {
2017-12-15 03:31:14 -05:00
const body = BoardsMockData[config.method.toUpperCase()][config.url];
return [200, body];
};
2017-12-15 03:31:14 -05:00
export const mockBoardService = (opts = {}) => {
const boardsEndpoint = opts.boardsEndpoint || '/test/issue-boards/-/boards.json';
2017-12-15 03:31:14 -05:00
const listsEndpoint = opts.listsEndpoint || '/test/-/boards/1/lists';
2017-09-06 02:49:19 -04:00
const bulkUpdatePath = opts.bulkUpdatePath || '';
const boardId = opts.boardId || '1';
return new BoardService({
boardsEndpoint,
listsEndpoint,
bulkUpdatePath,
boardId,
});
};
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',
};