diff options
Diffstat (limited to 'spec/javascripts/boards/issue_spec.js')
-rw-r--r-- | spec/javascripts/boards/issue_spec.js | 47 |
1 files changed, 30 insertions, 17 deletions
diff --git a/spec/javascripts/boards/issue_spec.js b/spec/javascripts/boards/issue_spec.js index e8387068831..437ab4bb3df 100644 --- a/spec/javascripts/boards/issue_spec.js +++ b/spec/javascripts/boards/issue_spec.js @@ -21,18 +21,22 @@ describe('Issue model', () => { id: 1, iid: 1, confidential: false, - labels: [{ - id: 1, - title: 'test', - color: 'red', - description: 'testing' - }], - assignees: [{ - id: 1, - name: 'name', - username: 'username', - avatar_url: 'http://avatar_url', - }], + labels: [ + { + id: 1, + title: 'test', + color: 'red', + description: 'testing', + }, + ], + assignees: [ + { + id: 1, + name: 'name', + username: 'username', + avatar_url: 'http://avatar_url', + }, + ], }); }); @@ -45,8 +49,9 @@ describe('Issue model', () => { id: 2, title: 'bug', color: 'blue', - description: 'bugs!' + description: 'bugs!', }); + expect(issue.labels.length).toBe(2); }); @@ -55,7 +60,7 @@ describe('Issue model', () => { id: 2, title: 'test', color: 'blue', - description: 'bugs!' + description: 'bugs!', }); expect(issue.labels.length).toBe(1); @@ -63,12 +68,14 @@ describe('Issue model', () => { it('finds label', () => { const label = issue.findLabel(issue.labels[0]); + expect(label).toBeDefined(); }); it('removes label', () => { const label = issue.findLabel(issue.labels[0]); issue.removeLabel(label); + expect(issue.labels.length).toBe(0); }); @@ -77,11 +84,13 @@ describe('Issue model', () => { id: 2, title: 'bug', color: 'blue', - description: 'bugs!' + description: 'bugs!', }); + expect(issue.labels.length).toBe(2); issue.removeLabels([issue.labels[0], issue.labels[1]]); + expect(issue.labels.length).toBe(0); }); @@ -98,17 +107,20 @@ describe('Issue model', () => { it('finds assignee', () => { const assignee = issue.findAssignee(issue.assignees[0]); + expect(assignee).toBeDefined(); }); it('removes assignee', () => { const assignee = issue.findAssignee(issue.assignees[0]); issue.removeAssignee(assignee); + expect(issue.assignees.length).toBe(0); }); it('removes all assignees', () => { issue.removeAllAssignees(); + expect(issue.assignees.length).toBe(0); }); @@ -131,6 +143,7 @@ describe('Issue model', () => { it('updates data', () => { issue.updateData({ subscribed: true }); + expect(issue.subscribed).toBe(true); }); @@ -149,7 +162,7 @@ describe('Issue model', () => { }); describe('update', () => { - it('passes assignee ids when there are assignees', (done) => { + it('passes assignee ids when there are assignees', done => { spyOn(Vue.http, 'patch').and.callFake((url, data) => { expect(data.issue.assignee_ids).toEqual([1]); done(); @@ -158,7 +171,7 @@ describe('Issue model', () => { issue.update('url'); }); - it('passes assignee ids of [0] when there are no assignees', (done) => { + it('passes assignee ids of [0] when there are no assignees', done => { spyOn(Vue.http, 'patch').and.callFake((url, data) => { expect(data.issue.assignee_ids).toEqual([0]); done(); |