Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(22)

Side by Side Diff: Tools/GardeningServer/model/test/ct-commit-log-tests.html

Issue 728023004: Remove GardeningServer. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 <!--
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
4 found in the LICENSE file.
5 -->
6
7 <link rel="import" href="../ct-commit-log.html">
8
9 <link rel="import" href="../ct-commit-mock.html">
10
11 <script>
12 (function () {
13
14 var assert = chai.assert;
15
16 describe('ct-commit-log model', function() {
17 it('handles response', function() {
18 var commit = new CTCommitMock();
19 var exampleCommitData = ')]}\n' +
20 JSON.stringify({
21 "log": [
22 {
23 "commit": "068885c2c5fda617e634bb73a107a0285af470ff",
24 "tree": "750c92f0fe1294bdddbf00cc14378d0d440290cb",
25 "parents": [
26 "e6ba81e00ae835946e069e5bd80bd533b11d8442"
27 ],
28 "author": {
29 "name": commit.author,
30 "email": commit.author,
31 "time": "Tue Jul 17 17:10:47 2012"
32 },
33 "committer": {
34 "name": commit.author,
35 "email": commit.author,
36 "time": "Tue Jul 17 17:10:47 2012"
37 },
38 "message": commit.message,
39 }
40 ]
41 });
42
43 var repositoryUrl = 'https://mockurl/?{revision}';
44 var repository = 'blink';
45
46 var log = new CTCommitLog();
47 log._handleResponse(repositoryUrl, repository, exampleCommitData);
48
49 var expectedCommits = {};
50 log._repositories.names.forEach(function(name) {
51 expectedCommits[name] = {};
52 });
53 expectedCommits[repository][commit.revision] = commit;
54 assert.deepEqual(log.commits, expectedCommits);
55
56 var revisions = [commit.revision];
57 assert.deepEqual(log.range(repository, revisions), [commit]);
58
59 // This url is different than the one above because CTCommitLog gets the url
60 // from CTRepositories.
61 var incompleteRepositoryUrl = log._repositories.repositories[repository].rep ositoryUrl;
62
63 var nextRev = String(commit.revision + 1);
64 var incompleteCommitAfter =
65 CTCommit.createIncomplete(incompleteRepositoryUrl, nextRev, repository);
66 revisions.push(nextRev);
67 // Expect an incomplete commit for revision + 1.
68 assert.deepEqual(log.range(repository, revisions), [commit, incompleteCommit After]);
69
70 // Expect two incomplete commits: one before and one after.
71 var prevRev = String(commit.revision - 1);
72 var incompleteCommitBefore =
73 CTCommit.createIncomplete(incompleteRepositoryUrl, prevRev, repository);
74 // Inserting at the beginning of the list.
75 revisions.splice(0, 0, prevRev);
76 assert.deepEqual(log.range(repository, revisions),
77 [incompleteCommitBefore, commit, incompleteCommitAfter]);
78 });
79 });
80
81 })();
82 </script>
OLDNEW
« no previous file with comments | « Tools/GardeningServer/model/test/ct-commit-list-tests.html ('k') | Tools/GardeningServer/model/test/ct-commit-tests.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698