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 */ /* global BoardService */
/* eslint-disable comma-dangle, no-unused-vars, quote-props */
import _ from 'underscore';
export const listObj = { export const listObj = {
id: 300, id: 300,
position: 0, position: 0,
...@@ -11,8 +8,8 @@ export const listObj = { ...@@ -11,8 +8,8 @@ export const listObj = {
id: 5000, id: 5000,
title: 'Testing', title: 'Testing',
color: 'red', color: 'red',
description: 'testing;' description: 'testing;',
} },
}; };
export const listObjDuplicate = { export const listObjDuplicate = {
...@@ -24,35 +21,37 @@ export const listObjDuplicate = { ...@@ -24,35 +21,37 @@ export const listObjDuplicate = {
id: listObj.label.id, id: listObj.label.id,
title: 'Testing', title: 'Testing',
color: 'red', color: 'red',
description: 'testing;' description: 'testing;',
} },
}; };
export const BoardsMockData = { export const BoardsMockData = {
'GET': { GET: {
'/test/-/boards/1/lists/300/issues?id=300&page=1&=': { '/test/-/boards/1/lists/300/issues?id=300&page=1&=': {
issues: [{ issues: [
title: 'Testing', {
id: 1, title: 'Testing',
iid: 1, id: 1,
confidential: false, iid: 1,
labels: [], confidential: false,
assignees: [], labels: [],
}], assignees: [],
} },
],
},
},
POST: {
'/test/-/boards/1/lists': listObj,
}, },
'POST': { PUT: {
'/test/-/boards/1/lists': listObj '/test/issue-boards/board/1/lists{/id}': {},
}, },
'PUT': { DELETE: {
'/test/issue-boards/board/1/lists{/id}': {} '/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]; const body = BoardsMockData[config.method.toUpperCase()][config.url];
return [200, body]; return [200, body];
}; };
......
/* eslint-disable */
import * as constants from '~/droplab/constants'; import * as constants from '~/droplab/constants';
describe('constants', function () { describe('constants', function() {
describe('DATA_TRIGGER', function () { describe('DATA_TRIGGER', function() {
it('should be `data-dropdown-trigger`', function() { it('should be `data-dropdown-trigger`', function() {
expect(constants.DATA_TRIGGER).toBe('data-dropdown-trigger'); expect(constants.DATA_TRIGGER).toBe('data-dropdown-trigger');
}); });
}); });
describe('DATA_DROPDOWN', function () { describe('DATA_DROPDOWN', function() {
it('should be `data-dropdown`', function() { it('should be `data-dropdown`', function() {
expect(constants.DATA_DROPDOWN).toBe('data-dropdown'); expect(constants.DATA_DROPDOWN).toBe('data-dropdown');
}); });
}); });
describe('SELECTED_CLASS', function () { describe('SELECTED_CLASS', function() {
it('should be `droplab-item-selected`', function() { it('should be `droplab-item-selected`', function() {
expect(constants.SELECTED_CLASS).toBe('droplab-item-selected'); expect(constants.SELECTED_CLASS).toBe('droplab-item-selected');
}); });
}); });
describe('ACTIVE_CLASS', function () { describe('ACTIVE_CLASS', function() {
it('should be `droplab-item-active`', function() { it('should be `droplab-item-active`', function() {
expect(constants.ACTIVE_CLASS).toBe('droplab-item-active'); 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() { it('should be a handlebars templating syntax regex', function() {
expect(constants.TEMPLATE_REGEX).toEqual(/\{\{(.+?)\}\}/g); expect(constants.TEMPLATE_REGEX).toEqual(/\{\{(.+?)\}\}/g);
}); });
}); });
describe('IGNORE_CLASS', function () { describe('IGNORE_CLASS', function() {
it('should be `droplab-item-ignore`', function() { it('should be `droplab-item-ignore`', function() {
expect(constants.IGNORE_CLASS).toBe('droplab-item-ignore'); expect(constants.IGNORE_CLASS).toBe('droplab-item-ignore');
}); });
......
This diff is collapsed.
/* eslint-disable quote-props*/
const RESPONSE_MAP = { const RESPONSE_MAP = {
'GET': { GET: {
'/gitlab-org/gitlab-shell/issues/5.json': { '/gitlab-org/gitlab-shell/issues/5.json': {
id: 45, id: 45,
iid: 5, iid: 5,
...@@ -27,7 +25,8 @@ const RESPONSE_MAP = { ...@@ -27,7 +25,8 @@ const RESPONSE_MAP = {
username: 'user0', username: 'user0',
id: 22, id: 22,
state: 'active', 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', web_url: 'http: //localhost:3001/user0',
}, },
{ {
...@@ -35,7 +34,8 @@ const RESPONSE_MAP = { ...@@ -35,7 +34,8 @@ const RESPONSE_MAP = {
username: 'tajuana', username: 'tajuana',
id: 18, id: 18,
state: 'active', 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', web_url: 'http: //localhost:3001/tajuana',
}, },
{ {
...@@ -43,7 +43,8 @@ const RESPONSE_MAP = { ...@@ -43,7 +43,8 @@ const RESPONSE_MAP = {
username: 'michaele.will', username: 'michaele.will',
id: 16, id: 16,
state: 'active', 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', web_url: 'http: //localhost:3001/michaele.will',
}, },
], ],
...@@ -72,7 +73,8 @@ const RESPONSE_MAP = { ...@@ -72,7 +73,8 @@ const RESPONSE_MAP = {
username: 'user0', username: 'user0',
id: 22, id: 22,
state: 'active', 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', web_url: 'http://localhost:3001/user0',
}, },
{ {
...@@ -80,7 +82,8 @@ const RESPONSE_MAP = { ...@@ -80,7 +82,8 @@ const RESPONSE_MAP = {
username: 'tajuana', username: 'tajuana',
id: 18, id: 18,
state: 'active', 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', web_url: 'http://localhost:3001/tajuana',
}, },
{ {
...@@ -88,7 +91,8 @@ const RESPONSE_MAP = { ...@@ -88,7 +91,8 @@ const RESPONSE_MAP = {
username: 'michaele.will', username: 'michaele.will',
id: 16, id: 16,
state: 'active', 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', web_url: 'http://localhost:3001/michaele.will',
}, },
], ],
...@@ -100,7 +104,8 @@ const RESPONSE_MAP = { ...@@ -100,7 +104,8 @@ const RESPONSE_MAP = {
username: 'user0', username: 'user0',
id: 22, id: 22,
state: 'active', 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', web_url: 'http://localhost:3001/user0',
}, },
{ {
...@@ -108,7 +113,8 @@ const RESPONSE_MAP = { ...@@ -108,7 +113,8 @@ const RESPONSE_MAP = {
username: 'tajuana', username: 'tajuana',
id: 18, id: 18,
state: 'active', 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', web_url: 'http://localhost:3001/tajuana',
}, },
{ {
...@@ -116,7 +122,8 @@ const RESPONSE_MAP = { ...@@ -116,7 +122,8 @@ const RESPONSE_MAP = {
username: 'michaele.will', username: 'michaele.will',
id: 16, id: 16,
state: 'active', 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', web_url: 'http://localhost:3001/michaele.will',
}, },
], ],
...@@ -126,20 +133,21 @@ const RESPONSE_MAP = { ...@@ -126,20 +133,21 @@ const RESPONSE_MAP = {
}, },
'/autocomplete/projects?project_id=15': [ '/autocomplete/projects?project_id=15': [
{ {
'id': 0, id: 0,
'name_with_namespace': 'No project', name_with_namespace: 'No project',
}, { },
'id': 20, {
'name_with_namespace': 'foo / bar', id: 20,
name_with_namespace: 'foo / bar',
}, },
], ],
}, },
'PUT': { PUT: {
'/gitlab-org/gitlab-shell/issues/5.json': { '/gitlab-org/gitlab-shell/issues/5.json': {
data: {}, data: {},
}, },
}, },
'POST': { POST: {
'/gitlab-org/gitlab-shell/issues/5/move': { '/gitlab-org/gitlab-shell/issues/5/move': {
id: 123, id: 123,
iid: 5, iid: 5,
...@@ -182,7 +190,8 @@ const mockData = { ...@@ -182,7 +190,8 @@ const mockData = {
id: 1, id: 1,
name: 'Administrator', name: 'Administrator',
username: 'root', 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: '/', rootPath: '/',
fullPath: '/gitlab-org/gitlab-shell', fullPath: '/gitlab-org/gitlab-shell',
...@@ -201,12 +210,14 @@ const mockData = { ...@@ -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]; const body = this.responseMap[request.method.toUpperCase()][request.url];
next(request.respondWith(JSON.stringify(body), { next(
status: 200, request.respondWith(JSON.stringify(body), {
})); status: 200,
}),
);
}.bind(mockData); }.bind(mockData);
export default mockData; export default mockData;
This diff is collapsed.
/* eslint-disable */
export const mockMetrics = [ export const mockMetrics = [
[1493716685, '4.30859375'], [1493716685, '4.30859375'],
[1493716745, '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