debian-mirror-gitlab/spec/javascripts/boards/mock_data.js

148 lines
3.4 KiB
JavaScript
Raw Normal View History

2018-12-13 13:39:08 +05:30
import BoardService from '~/boards/services/board_service';
2019-09-30 21:07:59 +05:30
import boardsStore from '~/boards/stores/boards_store';
2018-12-13 13:39:08 +05:30
2019-02-15 15:39:39 +05:30
export const boardObj = {
id: 1,
name: 'test',
milestone_id: null,
};
2018-03-17 18:26:18 +05:30
export const listObj = {
id: 300,
2016-09-13 17:45:13 +05:30
position: 0,
title: 'Test',
list_type: 'label',
2019-12-04 20:38:33 +05:30
weight: 3,
2016-09-13 17:45:13 +05:30
label: {
2018-03-17 18:26:18 +05:30
id: 5000,
2016-09-13 17:45:13 +05:30
title: 'Testing',
color: 'red',
2018-05-09 12:01:36 +05:30
description: 'testing;',
2019-07-31 22:56:46 +05:30
textColor: 'white',
2018-05-09 12:01:36 +05:30
},
2016-09-13 17:45:13 +05:30
};
2018-03-17 18:26:18 +05:30
export const listObjDuplicate = {
2017-08-17 22:00:37 +05:30
id: listObj.id,
2016-09-13 17:45:13 +05:30
position: 1,
title: 'Test',
list_type: 'label',
2019-12-04 20:38:33 +05:30
weight: 3,
2016-09-13 17:45:13 +05:30
label: {
2017-08-17 22:00:37 +05:30
id: listObj.label.id,
2016-09-13 17:45:13 +05:30
title: 'Testing',
color: 'red',
2018-05-09 12:01:36 +05:30
description: 'testing;',
},
2016-09-13 17:45:13 +05:30
};
2018-03-17 18:26:18 +05:30
export const BoardsMockData = {
2018-05-09 12:01:36 +05:30
GET: {
2018-11-20 20:47:30 +05:30
'/test/-/boards/1/lists/300/issues?id=300&page=1': {
2018-05-09 12:01:36 +05:30
issues: [
{
title: 'Testing',
id: 1,
iid: 1,
confidential: false,
labels: [],
assignees: [],
},
],
},
2019-09-04 21:01:54 +05:30
'/test/issue-boards/-/milestones.json': [
2019-02-15 15:39:39 +05:30
{
id: 1,
title: 'test',
},
],
2018-05-09 12:01:36 +05:30
},
POST: {
'/test/-/boards/1/lists': listObj,
2016-09-13 17:45:13 +05:30
},
2018-05-09 12:01:36 +05:30
PUT: {
2019-09-04 21:01:54 +05:30
'/test/issue-boards/-/board/1/lists{/id}': {},
2016-09-13 17:45:13 +05:30
},
2018-05-09 12:01:36 +05:30
DELETE: {
2019-09-04 21:01:54 +05:30
'/test/issue-boards/-/board/1/lists{/id}': {},
2016-09-13 17:45:13 +05:30
},
};
2018-05-09 12:01:36 +05:30
export const boardsMockInterceptor = config => {
2018-03-17 18:26:18 +05:30
const body = BoardsMockData[config.method.toUpperCase()][config.url];
return [200, body];
2017-08-17 22:00:37 +05:30
};
2018-03-17 18:26:18 +05:30
export const mockBoardService = (opts = {}) => {
2019-09-04 21:01:54 +05:30
const boardsEndpoint = opts.boardsEndpoint || '/test/issue-boards/-/boards.json';
2018-03-17 18:26:18 +05:30
const listsEndpoint = opts.listsEndpoint || '/test/-/boards/1/lists';
const bulkUpdatePath = opts.bulkUpdatePath || '';
const boardId = opts.boardId || '1';
2019-09-30 21:07:59 +05:30
boardsStore.setEndpoints({
2018-03-17 18:26:18 +05:30
boardsEndpoint,
listsEndpoint,
bulkUpdatePath,
boardId,
});
2019-09-30 21:07:59 +05:30
return new BoardService();
2018-03-17 18:26:18 +05:30
};
2019-02-15 15:39:39 +05:30
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',
};