Skip to content
Snippets Groups Projects
Commit 88280aa6 authored by Phil Hughes's avatar Phil Hughes
Browse files

Fixed up issue boards JS specs

The objects where passed in the wrong order so would actually cause a timeout eventually. Also changed to used random numbers so this error would of been more obvious

Closes #29329
parent 4a8e516c
No related branches found
No related tags found
No related merge requests found
Loading
@@ -50,9 +50,9 @@ describe('Store', () => {
Loading
@@ -50,9 +50,9 @@ describe('Store', () => {
   
it('finds list by ID', () => { it('finds list by ID', () => {
gl.issueBoards.BoardsStore.addList(listObj); gl.issueBoards.BoardsStore.addList(listObj);
const list = gl.issueBoards.BoardsStore.findList('id', 1); const list = gl.issueBoards.BoardsStore.findList('id', listObj.id);
   
expect(list.id).toBe(1); expect(list.id).toBe(listObj.id);
}); });
   
it('finds list by type', () => { it('finds list by type', () => {
Loading
@@ -64,7 +64,7 @@ describe('Store', () => {
Loading
@@ -64,7 +64,7 @@ describe('Store', () => {
   
it('gets issue when new list added', (done) => { it('gets issue when new list added', (done) => {
gl.issueBoards.BoardsStore.addList(listObj); gl.issueBoards.BoardsStore.addList(listObj);
const list = gl.issueBoards.BoardsStore.findList('id', 1); const list = gl.issueBoards.BoardsStore.findList('id', listObj.id);
   
expect(gl.issueBoards.BoardsStore.state.lists.length).toBe(1); expect(gl.issueBoards.BoardsStore.state.lists.length).toBe(1);
   
Loading
@@ -89,9 +89,9 @@ describe('Store', () => {
Loading
@@ -89,9 +89,9 @@ describe('Store', () => {
expect(gl.issueBoards.BoardsStore.state.lists.length).toBe(1); expect(gl.issueBoards.BoardsStore.state.lists.length).toBe(1);
   
setTimeout(() => { setTimeout(() => {
const list = gl.issueBoards.BoardsStore.findList('id', 1); const list = gl.issueBoards.BoardsStore.findList('id', listObj.id);
expect(list).toBeDefined(); expect(list).toBeDefined();
expect(list.id).toBe(1); expect(list.id).toBe(listObj.id);
expect(list.position).toBe(0); expect(list.position).toBe(0);
done(); done();
}, 0); }, 0);
Loading
@@ -126,7 +126,7 @@ describe('Store', () => {
Loading
@@ -126,7 +126,7 @@ describe('Store', () => {
   
expect(gl.issueBoards.BoardsStore.state.lists.length).toBe(1); expect(gl.issueBoards.BoardsStore.state.lists.length).toBe(1);
   
gl.issueBoards.BoardsStore.removeList(1, 'label'); gl.issueBoards.BoardsStore.removeList(listObj.id, 'label');
   
expect(gl.issueBoards.BoardsStore.state.lists.length).toBe(0); expect(gl.issueBoards.BoardsStore.state.lists.length).toBe(0);
}); });
Loading
@@ -137,7 +137,7 @@ describe('Store', () => {
Loading
@@ -137,7 +137,7 @@ describe('Store', () => {
   
expect(gl.issueBoards.BoardsStore.state.lists.length).toBe(2); expect(gl.issueBoards.BoardsStore.state.lists.length).toBe(2);
   
gl.issueBoards.BoardsStore.moveList(listOne, ['2', '1']); gl.issueBoards.BoardsStore.moveList(listOne, [listObjDuplicate.id, listObj.id]);
   
expect(listOne.position).toBe(1); expect(listOne.position).toBe(1);
}); });
Loading
Loading
Loading
@@ -43,7 +43,7 @@ describe('List model', () => {
Loading
@@ -43,7 +43,7 @@ describe('List model', () => {
list = new List({ list = new List({
title: 'test', title: 'test',
label: { label: {
id: 1, id: _.random(10000),
title: 'test', title: 'test',
color: 'red' color: 'red'
} }
Loading
@@ -51,7 +51,7 @@ describe('List model', () => {
Loading
@@ -51,7 +51,7 @@ describe('List model', () => {
list.save(); list.save();
   
setTimeout(() => { setTimeout(() => {
expect(list.id).toBe(1); expect(list.id).toBe(listObj.id);
expect(list.type).toBe('label'); expect(list.type).toBe('label');
expect(list.position).toBe(0); expect(list.position).toBe(0);
done(); done();
Loading
@@ -60,7 +60,7 @@ describe('List model', () => {
Loading
@@ -60,7 +60,7 @@ describe('List model', () => {
   
it('destroys the list', (done) => { it('destroys the list', (done) => {
gl.issueBoards.BoardsStore.addList(listObj); gl.issueBoards.BoardsStore.addList(listObj);
list = gl.issueBoards.BoardsStore.findList('id', 1); list = gl.issueBoards.BoardsStore.findList('id', listObj.id);
expect(gl.issueBoards.BoardsStore.state.lists.length).toBe(1); expect(gl.issueBoards.BoardsStore.state.lists.length).toBe(1);
list.destroy(); list.destroy();
   
Loading
@@ -92,7 +92,7 @@ describe('List model', () => {
Loading
@@ -92,7 +92,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',
iid: 1, iid: _.random(10000),
confidential: false, confidential: false,
labels: [list.label, listDup.label] labels: [list.label, listDup.label]
}); });
Loading
@@ -102,7 +102,7 @@ describe('List model', () => {
Loading
@@ -102,7 +102,7 @@ describe('List model', () => {
   
spyOn(gl.boardService, 'moveIssue').and.callThrough(); spyOn(gl.boardService, 'moveIssue').and.callThrough();
   
listDup.updateIssueLabel(list, issue); listDup.updateIssueLabel(issue, list);
   
expect(gl.boardService.moveIssue) expect(gl.boardService.moveIssue)
.toHaveBeenCalledWith(issue.id, list.id, listDup.id, undefined, undefined); .toHaveBeenCalledWith(issue.id, list.id, listDup.id, undefined, undefined);
Loading
Loading
/* eslint-disable comma-dangle, no-unused-vars, quote-props */ /* eslint-disable comma-dangle, no-unused-vars, quote-props */
   
const listObj = { const listObj = {
id: 1, id: _.random(10000),
position: 0, position: 0,
title: 'Test', title: 'Test',
list_type: 'label', list_type: 'label',
label: { label: {
id: 1, id: _.random(10000),
title: 'Testing', title: 'Testing',
color: 'red', color: 'red',
description: 'testing;' description: 'testing;'
Loading
@@ -14,12 +14,12 @@ const listObj = {
Loading
@@ -14,12 +14,12 @@ const listObj = {
}; };
   
const listObjDuplicate = { const listObjDuplicate = {
id: 2, id: listObj.id,
position: 1, position: 1,
title: 'Test', title: 'Test',
list_type: 'label', list_type: 'label',
label: { label: {
id: 2, id: listObj.label.id,
title: 'Testing', title: 'Testing',
color: 'red', color: 'red',
description: 'testing;' description: 'testing;'
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment