Commit 8be02246 authored by Simon Knox's avatar Simon Knox

start fixing js specs

parent 0472ff1f
......@@ -32,6 +32,7 @@ describe('Board list component', () => {
const list = new List(listObj);
const issue = new ListIssue({
title: 'Testing',
id: 1,
iid: 1,
confidential: false,
labels: [],
......
......@@ -97,6 +97,7 @@ describe('List model', () => {
const listDup = new List(listObjDuplicate);
const issue = new ListIssue({
title: 'Testing',
id: _.random(10000),
iid: _.random(10000),
confidential: false,
labels: [list.label, listDup.label],
......@@ -123,7 +124,8 @@ describe('List model', () => {
for (let i = 0; i < 30; i += 1) {
list.issues.push(new ListIssue({
title: 'Testing',
iid: _.random(10000) + i,
id: _.random(10000) + i,
iid: _.random(1000) + i,
confidential: false,
labels: [list.label],
assignees: [],
......@@ -142,7 +144,7 @@ describe('List model', () => {
it('does not increase page number if issue count is less than the page size', () => {
list.issues.push(new ListIssue({
title: 'Testing',
iid: _.random(10000),
id: _.random(10000),
confidential: false,
labels: [list.label],
assignees: [],
......@@ -161,7 +163,7 @@ describe('List model', () => {
spyOn(gl.boardService, 'newIssue').and.returnValue(Promise.resolve({
json() {
return {
iid: 42,
id: 42,
};
},
}));
......@@ -170,14 +172,14 @@ describe('List model', () => {
it('adds new issue to top of list', (done) => {
list.issues.push(new ListIssue({
title: 'Testing',
iid: _.random(10000),
id: _.random(10000),
confidential: false,
labels: [list.label],
assignees: [],
}));
const dummyIssue = new ListIssue({
title: 'new issue',
iid: _.random(10000),
id: _.random(10000),
confidential: false,
labels: [list.label],
assignees: [],
......
......@@ -34,7 +34,17 @@ const listObjDuplicate = {
const BoardsMockData = {
'GET': {
'/test/issue-boards/board/1/lists{/id}/issues': {
'/test/boards/1{/id}/issues': {
issues: [{
title: 'Testing',
id: 1,
iid: 1,
confidential: false,
labels: [],
assignees: [],
}],
},
'/boards/1{/id}/issues': {
issues: [{
title: 'Testing',
id: 1,
......@@ -51,7 +61,7 @@ const BoardsMockData = {
}],
},
'POST': {
'/test/issue-boards/board/1/lists{/id}': listObj
'/boards/1{/id}': listObj
},
'PUT': {
'/test/issue-boards/board/1/lists{/id}': {}
......@@ -76,11 +86,16 @@ window.BoardsMockData = BoardsMockData;
window.boardsMockInterceptor = boardsMockInterceptor;
// eslint-disable-next-line import/prefer-default-export
export function mockBoardService() {
export function mockBoardService(opts = {}) {
const boardsEndpoint = opts.boardsEndpoint || '/test/issue-boards/board';
const listsEndpoint = opts.listsEndpoint || '/test/boards/1';
const bulkUpdatePath = opts.bulkUpdatePath || '';
const boardId = opts.boardId || '1';
return new BoardService({
boardsEndpoint: '/test/issue-boards/board',
listsEndpoint: '/test/boards/1',
bulkUpdatePath: '',
boardId: '1',
boardsEndpoint,
listsEndpoint,
bulkUpdatePath,
boardId,
});
}
......@@ -10,6 +10,7 @@ describe('Dropdown User', () => {
beforeEach(() => {
spyOn(gl.DropdownUser.prototype, 'bindEvents').and.callFake(() => {});
spyOn(gl.DropdownUser.prototype, 'getProjectId').and.callFake(() => {});
spyOn(gl.DropdownUser.prototype, 'getGroupId').and.callFake(() => {});
spyOn(gl.DropdownUtils, 'getSearchInput').and.callFake(() => {});
dropdownUser = new gl.DropdownUser({
......@@ -38,6 +39,7 @@ describe('Dropdown User', () => {
beforeEach(() => {
spyOn(gl.DropdownUser.prototype, 'bindEvents').and.callFake(() => {});
spyOn(gl.DropdownUser.prototype, 'getProjectId').and.callFake(() => {});
spyOn(gl.DropdownUser.prototype, 'getGroupId').and.callFake(() => {});
});
it('should return endpoint', () => {
......
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