提交 63a4daa5 编写于 作者: P Phil Hughes

Fixed failing teaspoon tests

上级 3f769e78
class Issue {
class ListIssue {
constructor (obj) {
this.id = obj.iid;
this.title = obj.title;
this.confidential = obj.confidential;
if (obj.assignee) {
this.assignee = new User(obj.assignee);
this.assignee = new ListUser(obj.assignee);
}
this.labels = [];
_.each(obj.labels, (label) => {
this.labels.push(new Label(label));
this.labels.push(new ListLabel(label));
});
this.priority = _.reduce(this.labels, (max, label) => {
......@@ -24,7 +24,7 @@ class Issue {
const hasLabel = this.findLabel(label);
if (!hasLabel) {
this.labels.push(new Label(label));
this.labels.push(new ListLabel(label));
}
}
}
......
class Label {
class ListLabel {
constructor (obj) {
this.id = obj.id;
this.title = obj.title;
......
......@@ -10,7 +10,7 @@ class List {
this.issues = [];
if (obj.label) {
this.label = new Label(obj.label);
this.label = new ListLabel(obj.label);
}
if (this.type !== 'blank' && this.id) {
......@@ -85,8 +85,8 @@ class List {
}
createIssues (data) {
_.each(data, (issue) => {
this.issues.push(new Issue(issue));
_.each(data, (issueObj) => {
this.issues.push(new ListIssue(issueObj));
});
}
......
class User {
class ListUser {
constructor (user) {
this.id = user.id;
this.name = user.name;
......
......@@ -54,6 +54,7 @@
setTimeout(() => {
expect(list.issues.length).toBe(1);
expect(list.issues[0].id).toBe(1);
done();
}, 0);
});
......@@ -135,10 +136,10 @@
expect(BoardsStore.state.lists.length).toBe(2);
setTimeout(() => {
const list = BoardsStore.findList('id', 1);
const listTwo = BoardsStore.findList('id', 2);
const list = BoardsStore.findList('id', 1),
listTwo = BoardsStore.findList('id', 2);
setTimeout(() => {
expect(list.issues.length).toBe(1);
expect(listTwo.issues.length).toBe(1);
......@@ -148,7 +149,7 @@
expect(listTwo.issues.length).toBe(1);
done();
});
}, 0);
});
});
});
......
......@@ -19,7 +19,7 @@ describe('Issue model', () => {
gl.boardService = new BoardService('/test/issue-boards/board');
BoardsStore.create();
issue = new Issue({
issue = new ListIssue({
title: 'Testing',
iid: 1,
confidential: false,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册