Commit 63a4daa5 authored by Phil Hughes's avatar Phil Hughes

Fixed failing teaspoon tests

parent 3f769e78
class Issue { class ListIssue {
constructor (obj) { constructor (obj) {
this.id = obj.iid; this.id = obj.iid;
this.title = obj.title; this.title = obj.title;
this.confidential = obj.confidential; this.confidential = obj.confidential;
if (obj.assignee) { if (obj.assignee) {
this.assignee = new User(obj.assignee); this.assignee = new ListUser(obj.assignee);
} }
this.labels = []; this.labels = [];
_.each(obj.labels, (label) => { _.each(obj.labels, (label) => {
this.labels.push(new Label(label)); this.labels.push(new ListLabel(label));
}); });
this.priority = _.reduce(this.labels, (max, label) => { this.priority = _.reduce(this.labels, (max, label) => {
...@@ -24,7 +24,7 @@ class Issue { ...@@ -24,7 +24,7 @@ class Issue {
const hasLabel = this.findLabel(label); const hasLabel = this.findLabel(label);
if (!hasLabel) { if (!hasLabel) {
this.labels.push(new Label(label)); this.labels.push(new ListLabel(label));
} }
} }
} }
......
class Label { class ListLabel {
constructor (obj) { constructor (obj) {
this.id = obj.id; this.id = obj.id;
this.title = obj.title; this.title = obj.title;
......
...@@ -10,7 +10,7 @@ class List { ...@@ -10,7 +10,7 @@ class List {
this.issues = []; this.issues = [];
if (obj.label) { if (obj.label) {
this.label = new Label(obj.label); this.label = new ListLabel(obj.label);
} }
if (this.type !== 'blank' && this.id) { if (this.type !== 'blank' && this.id) {
...@@ -85,8 +85,8 @@ class List { ...@@ -85,8 +85,8 @@ class List {
} }
createIssues (data) { createIssues (data) {
_.each(data, (issue) => { _.each(data, (issueObj) => {
this.issues.push(new Issue(issue)); this.issues.push(new ListIssue(issueObj));
}); });
} }
......
class User { class ListUser {
constructor (user) { constructor (user) {
this.id = user.id; this.id = user.id;
this.name = user.name; this.name = user.name;
......
...@@ -54,6 +54,7 @@ ...@@ -54,6 +54,7 @@
setTimeout(() => { setTimeout(() => {
expect(list.issues.length).toBe(1); expect(list.issues.length).toBe(1);
expect(list.issues[0].id).toBe(1);
done(); done();
}, 0); }, 0);
}); });
...@@ -135,10 +136,10 @@ ...@@ -135,10 +136,10 @@
expect(BoardsStore.state.lists.length).toBe(2); expect(BoardsStore.state.lists.length).toBe(2);
setTimeout(() => { const list = BoardsStore.findList('id', 1),
const list = BoardsStore.findList('id', 1); listTwo = BoardsStore.findList('id', 2);
const listTwo = BoardsStore.findList('id', 2);
setTimeout(() => {
expect(list.issues.length).toBe(1); expect(list.issues.length).toBe(1);
expect(listTwo.issues.length).toBe(1); expect(listTwo.issues.length).toBe(1);
...@@ -148,7 +149,7 @@ ...@@ -148,7 +149,7 @@
expect(listTwo.issues.length).toBe(1); expect(listTwo.issues.length).toBe(1);
done(); done();
}); }, 0);
}); });
}); });
}); });
......
...@@ -19,7 +19,7 @@ describe('Issue model', () => { ...@@ -19,7 +19,7 @@ describe('Issue model', () => {
gl.boardService = new BoardService('/test/issue-boards/board'); gl.boardService = new BoardService('/test/issue-boards/board');
BoardsStore.create(); BoardsStore.create();
issue = new Issue({ issue = new ListIssue({
title: 'Testing', title: 'Testing',
iid: 1, iid: 1,
confidential: false, confidential: false,
......
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