| OLD | NEW |
| 1 <!-- | 1 <!-- |
| 2 Copyright 2014 The Chromium Authors. All rights reserved. | 2 Copyright 2014 The Chromium Authors. All rights reserved. |
| 3 Use of this source code is governed by a BSD-style license that can be | 3 Use of this source code is governed by a BSD-style license that can be |
| 4 found in the LICENSE file. | 4 found in the LICENSE file. |
| 5 --> | 5 --> |
| 6 | 6 |
| 7 <link rel="import" href="../ct-commit-list.html"> | 7 <link rel="import" href="../ct-commit-list.html"> |
| 8 | 8 |
| 9 <script> | 9 <script> |
| 10 (function () { | 10 (function () { |
| 11 | 11 |
| 12 var assert = chai.assert; | 12 var assert = chai.assert; |
| 13 | 13 |
| 14 describe('ct-commit-list', function() { | 14 describe('ct-commit-list', function() { |
| 15 describe('commit list Model', function() { | 15 describe('commit list Model', function() { |
| 16 it('returns commits', function() { | 16 it('returns commits', function() { |
| 17 var group = { | 17 var revisions = ['blink:158545']; |
| 18 failures: [ | 18 var cl = new CTCommitList(new CTCommitLogMock(), revisions); |
| 19 { | 19 assert.lengthOf(cl._getCommitsForRepo('blink'), 1); |
| 20 firstFailingRevisions: { | |
| 21 'blink': 158545 | |
| 22 }, | |
| 23 lastPassingRevisions: { | |
| 24 'blink': 158544 | |
| 25 } | |
| 26 } | |
| 27 ] | |
| 28 }; | |
| 29 | |
| 30 var cl = new CTCommitList(group, new CTCommitLogMock()); | |
| 31 assert.lengthOf(cl._commits('blink'), 1); | |
| 32 }); | |
| 33 | |
| 34 it('handles a backwards revision range', function() { | |
| 35 var group = { | |
| 36 failures: [ | |
| 37 { | |
| 38 firstFailingRevisions: { | |
| 39 'blink': 158544 | |
| 40 }, | |
| 41 lastPassingRevisions: { | |
| 42 'blink': 158545 | |
| 43 } | |
| 44 } | |
| 45 ] | |
| 46 }; | |
| 47 | |
| 48 var cl = new CTCommitList(group, new CTCommitLogMock()); | |
| 49 assert.lengthOf(cl._commits('blink'), 0); | |
| 50 }); | 20 }); |
| 51 | 21 |
| 52 it ('returns repositories', function() { | 22 it ('returns repositories', function() { |
| 53 var group = { | 23 var revisions = ['blink:158545']; |
| 54 failures: [ | 24 var cl = new CTCommitList(new CTCommitLogMock(), revisions); |
| 55 { | |
| 56 firstFailingRevisions: { | |
| 57 'blink': 158545 | |
| 58 }, | |
| 59 lastPassingRevisions: { | |
| 60 'blink': 158544 | |
| 61 } | |
| 62 } | |
| 63 ] | |
| 64 }; | |
| 65 | |
| 66 var cl = new CTCommitList(group, new CTCommitLogMock()); | |
| 67 var repos = cl.repositories; | 25 var repos = cl.repositories; |
| 68 assert.lengthOf(repos, 1); | 26 assert.lengthOf(repos, 1); |
| 69 assert.equal(repos[0].name, 'blink'); | 27 assert.equal(repos[0].name, 'blink'); |
| 70 assert.lengthOf(repos[0].commits, 1); | 28 assert.lengthOf(repos[0].commits, 1); |
| 71 assert.equal(repos[0].range, '158545 : 158545') | 29 assert.equal(repos[0].range, '158545 : 158545') |
| 72 }); | 30 }); |
| 73 }); | 31 }); |
| 74 }); | 32 }); |
| 75 | 33 |
| 76 })(); | 34 })(); |
| 77 </script> | 35 </script> |
| OLD | NEW |