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

start fixing js specs

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