Commit 6b5ec93a authored by Clement Ho's avatar Clement Ho

Merge branch 'fl-prettier-mock-data' into 'master'

Prettify mock data files

See merge request gitlab-org/gitlab-ce!18091
parents 15eaf2de 3e6e2ef6
/* global BoardService */
/* eslint-disable comma-dangle, no-unused-vars, quote-props */
import _ from 'underscore';
export const listObj = {
id: 300,
position: 0,
......@@ -11,8 +8,8 @@ export const listObj = {
id: 5000,
title: 'Testing',
color: 'red',
description: 'testing;'
}
description: 'testing;',
},
};
export const listObjDuplicate = {
......@@ -24,35 +21,37 @@ export const listObjDuplicate = {
id: listObj.label.id,
title: 'Testing',
color: 'red',
description: 'testing;'
}
description: 'testing;',
},
};
export const BoardsMockData = {
'GET': {
GET: {
'/test/-/boards/1/lists/300/issues?id=300&page=1&=': {
issues: [{
title: 'Testing',
id: 1,
iid: 1,
confidential: false,
labels: [],
assignees: [],
}],
}
issues: [
{
title: 'Testing',
id: 1,
iid: 1,
confidential: false,
labels: [],
assignees: [],
},
],
},
},
POST: {
'/test/-/boards/1/lists': listObj,
},
'POST': {
'/test/-/boards/1/lists': listObj
PUT: {
'/test/issue-boards/board/1/lists{/id}': {},
},
'PUT': {
'/test/issue-boards/board/1/lists{/id}': {}
DELETE: {
'/test/issue-boards/board/1/lists{/id}': {},
},
'DELETE': {
'/test/issue-boards/board/1/lists{/id}': {}
}
};
export const boardsMockInterceptor = (config) => {
export const boardsMockInterceptor = config => {
const body = BoardsMockData[config.method.toUpperCase()][config.url];
return [200, body];
};
......
/* eslint-disable */
import * as constants from '~/droplab/constants';
describe('constants', function () {
describe('DATA_TRIGGER', function () {
describe('constants', function() {
describe('DATA_TRIGGER', function() {
it('should be `data-dropdown-trigger`', function() {
expect(constants.DATA_TRIGGER).toBe('data-dropdown-trigger');
});
});
describe('DATA_DROPDOWN', function () {
describe('DATA_DROPDOWN', function() {
it('should be `data-dropdown`', function() {
expect(constants.DATA_DROPDOWN).toBe('data-dropdown');
});
});
describe('SELECTED_CLASS', function () {
describe('SELECTED_CLASS', function() {
it('should be `droplab-item-selected`', function() {
expect(constants.SELECTED_CLASS).toBe('droplab-item-selected');
});
});
describe('ACTIVE_CLASS', function () {
describe('ACTIVE_CLASS', function() {
it('should be `droplab-item-active`', function() {
expect(constants.ACTIVE_CLASS).toBe('droplab-item-active');
});
});
describe('TEMPLATE_REGEX', function () {
describe('TEMPLATE_REGEX', function() {
it('should be a handlebars templating syntax regex', function() {
expect(constants.TEMPLATE_REGEX).toEqual(/\{\{(.+?)\}\}/g);
});
});
describe('IGNORE_CLASS', function () {
describe('IGNORE_CLASS', function() {
it('should be `droplab-item-ignore`', function() {
expect(constants.IGNORE_CLASS).toBe('droplab-item-ignore');
});
......
This diff is collapsed.
/* eslint-disable quote-props*/
const RESPONSE_MAP = {
'GET': {
GET: {
'/gitlab-org/gitlab-shell/issues/5.json': {
id: 45,
iid: 5,
......@@ -27,7 +25,8 @@ const RESPONSE_MAP = {
username: 'user0',
id: 22,
state: 'active',
avatar_url: 'https://www.gravatar.com/avatar/52e4ce24a915fb7e51e1ad3b57f4b00a?s=80\u0026d=identicon',
avatar_url:
'https://www.gravatar.com/avatar/52e4ce24a915fb7e51e1ad3b57f4b00a?s=80\u0026d=identicon',
web_url: 'http: //localhost:3001/user0',
},
{
......@@ -35,7 +34,8 @@ const RESPONSE_MAP = {
username: 'tajuana',
id: 18,
state: 'active',
avatar_url: 'https://www.gravatar.com/avatar/4852a41fb41616bf8f140d3701673f53?s=80\u0026d=identicon',
avatar_url:
'https://www.gravatar.com/avatar/4852a41fb41616bf8f140d3701673f53?s=80\u0026d=identicon',
web_url: 'http: //localhost:3001/tajuana',
},
{
......@@ -43,7 +43,8 @@ const RESPONSE_MAP = {
username: 'michaele.will',
id: 16,
state: 'active',
avatar_url: 'https://www.gravatar.com/avatar/e301827eb03be955c9c172cb9a8e4e8a?s=80\u0026d=identicon',
avatar_url:
'https://www.gravatar.com/avatar/e301827eb03be955c9c172cb9a8e4e8a?s=80\u0026d=identicon',
web_url: 'http: //localhost:3001/michaele.will',
},
],
......@@ -72,7 +73,8 @@ const RESPONSE_MAP = {
username: 'user0',
id: 22,
state: 'active',
avatar_url: 'https://www.gravatar.com/avatar/52e4ce24a915fb7e51e1ad3b57f4b00a?s=80\u0026d=identicon',
avatar_url:
'https://www.gravatar.com/avatar/52e4ce24a915fb7e51e1ad3b57f4b00a?s=80\u0026d=identicon',
web_url: 'http://localhost:3001/user0',
},
{
......@@ -80,7 +82,8 @@ const RESPONSE_MAP = {
username: 'tajuana',
id: 18,
state: 'active',
avatar_url: 'https://www.gravatar.com/avatar/4852a41fb41616bf8f140d3701673f53?s=80\u0026d=identicon',
avatar_url:
'https://www.gravatar.com/avatar/4852a41fb41616bf8f140d3701673f53?s=80\u0026d=identicon',
web_url: 'http://localhost:3001/tajuana',
},
{
......@@ -88,7 +91,8 @@ const RESPONSE_MAP = {
username: 'michaele.will',
id: 16,
state: 'active',
avatar_url: 'https://www.gravatar.com/avatar/e301827eb03be955c9c172cb9a8e4e8a?s=80\u0026d=identicon',
avatar_url:
'https://www.gravatar.com/avatar/e301827eb03be955c9c172cb9a8e4e8a?s=80\u0026d=identicon',
web_url: 'http://localhost:3001/michaele.will',
},
],
......@@ -100,7 +104,8 @@ const RESPONSE_MAP = {
username: 'user0',
id: 22,
state: 'active',
avatar_url: 'https://www.gravatar.com/avatar/52e4ce24a915fb7e51e1ad3b57f4b00a?s=80\u0026d=identicon',
avatar_url:
'https://www.gravatar.com/avatar/52e4ce24a915fb7e51e1ad3b57f4b00a?s=80\u0026d=identicon',
web_url: 'http://localhost:3001/user0',
},
{
......@@ -108,7 +113,8 @@ const RESPONSE_MAP = {
username: 'tajuana',
id: 18,
state: 'active',
avatar_url: 'https://www.gravatar.com/avatar/4852a41fb41616bf8f140d3701673f53?s=80\u0026d=identicon',
avatar_url:
'https://www.gravatar.com/avatar/4852a41fb41616bf8f140d3701673f53?s=80\u0026d=identicon',
web_url: 'http://localhost:3001/tajuana',
},
{
......@@ -116,7 +122,8 @@ const RESPONSE_MAP = {
username: 'michaele.will',
id: 16,
state: 'active',
avatar_url: 'https://www.gravatar.com/avatar/e301827eb03be955c9c172cb9a8e4e8a?s=80\u0026d=identicon',
avatar_url:
'https://www.gravatar.com/avatar/e301827eb03be955c9c172cb9a8e4e8a?s=80\u0026d=identicon',
web_url: 'http://localhost:3001/michaele.will',
},
],
......@@ -126,20 +133,21 @@ const RESPONSE_MAP = {
},
'/autocomplete/projects?project_id=15': [
{
'id': 0,
'name_with_namespace': 'No project',
}, {
'id': 20,
'name_with_namespace': 'foo / bar',
id: 0,
name_with_namespace: 'No project',
},
{
id: 20,
name_with_namespace: 'foo / bar',
},
],
},
'PUT': {
PUT: {
'/gitlab-org/gitlab-shell/issues/5.json': {
data: {},
},
},
'POST': {
POST: {
'/gitlab-org/gitlab-shell/issues/5/move': {
id: 123,
iid: 5,
......@@ -182,7 +190,8 @@ const mockData = {
id: 1,
name: 'Administrator',
username: 'root',
avatar_url: 'https://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon',
avatar_url:
'https://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon',
},
rootPath: '/',
fullPath: '/gitlab-org/gitlab-shell',
......@@ -201,12 +210,14 @@ const mockData = {
},
};
mockData.sidebarMockInterceptor = function (request, next) {
mockData.sidebarMockInterceptor = function(request, next) {
const body = this.responseMap[request.method.toUpperCase()][request.url];
next(request.respondWith(JSON.stringify(body), {
status: 200,
}));
next(
request.respondWith(JSON.stringify(body), {
status: 200,
}),
);
}.bind(mockData);
export default mockData;
This diff is collapsed.
/* eslint-disable */
export const mockMetrics = [
[1493716685, '4.30859375'],
[1493716745, '4.30859375'],
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment