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-log.html"> | 7 <link rel="import" href="../ct-commit-log.html"> |
8 | 8 |
9 <link rel="import" href="../ct-commit-mock.html"> | 9 <link rel="import" href="../ct-commit-mock.html"> |
10 | 10 |
(...skipping 29 matching lines...) Expand all Loading... |
40 ] | 40 ] |
41 }); | 41 }); |
42 | 42 |
43 var repositoryUrl = 'http://mockurl/?{revision}'; | 43 var repositoryUrl = 'http://mockurl/?{revision}'; |
44 var repository = 'blink'; | 44 var repository = 'blink'; |
45 | 45 |
46 var log = new CTCommitLog(); | 46 var log = new CTCommitLog(); |
47 log._handleResponse(repositoryUrl, repository, exampleCommitData); | 47 log._handleResponse(repositoryUrl, repository, exampleCommitData); |
48 | 48 |
49 var expectedCommits = {}; | 49 var expectedCommits = {}; |
50 expectedCommits[repository] = {}; | 50 log._repositories.names.forEach(function(name) { |
| 51 expectedCommits[name] = {}; |
| 52 }); |
51 expectedCommits[repository][commit.revision] = commit; | 53 expectedCommits[repository][commit.revision] = commit; |
52 assert.deepEqual(log.commits, expectedCommits); | 54 assert.deepEqual(log.commits, expectedCommits); |
53 | 55 |
54 assert.deepEqual(log.range(repository, commit.revision, commit.revision), [c
ommit]); | 56 assert.deepEqual(log.range(repository, commit.revision, commit.revision), [c
ommit]); |
55 assert.deepEqual(log.range(repository, commit.revision, commit.revision + 1)
, [commit]); | 57 |
56 // This url is different than the one obove because CTCommitLog gets the url | 58 // This url is different than the one obove because CTCommitLog gets the url |
57 // from CTRepositories. | 59 // from CTRepositories. |
58 var incompleteRepositoryUrl = log._repositories.repositories[repository].rep
ositoryUrl; | 60 var incompleteRepositoryUrl = log._repositories.repositories[repository].rep
ositoryUrl; |
59 var incompleteCommit = CTCommit.createIncomplete(incompleteRepositoryUrl, co
mmit.revision - 1, repository); | 61 var incompleteCommitAfter = CTCommit.createIncomplete(incompleteRepositoryUr
l, commit.revision + 1, repository); |
60 assert.deepEqual(log.range(repository, commit.revision - 1, commit.revision
+ 1), [incompleteCommit, commit]); | 62 // Expect an incomplete commit for revision + 1. |
| 63 assert.deepEqual(log.range(repository, commit.revision, commit.revision + 1)
, [commit, incompleteCommitAfter]); |
| 64 |
| 65 // Expect two incomplete commits: one before and one after. |
| 66 var incompleteCommitBefore = CTCommit.createIncomplete(incompleteRepositoryU
rl, commit.revision - 1, repository); |
| 67 assert.deepEqual(log.range(repository, commit.revision - 1, commit.revision
+ 1), |
| 68 [incompleteCommitBefore, commit, incompleteCommitAfter]); |
61 }); | 69 }); |
62 }); | 70 }); |
63 | 71 |
64 })(); | 72 })(); |
65 </script> | 73 </script> |
OLD | NEW |