Fix the bug that 'TestGroupResultsViewer' creates unnecessary rows.
[WebKit.git] / Websites / perf.webkit.org / unit-tests / commit-set-tests.js
1 "use strict";
2
3 const assert = require('assert');
4 require('../tools/js/v3-models.js');
5 const MockModels = require('./resources/mock-v3-models.js').MockModels;
6 const MockRemoteAPI = require('../unit-tests/resources/mock-remote-api.js').MockRemoteAPI;
7
8 function createPatch()
9 {
10     return UploadedFile.ensureSingleton(453, {'createdAt': new Date('2017-05-01T19:16:53Z'), 'filename': 'patch.dat', 'extension': '.dat', 'author': 'some user',
11         size: 534637, sha256: '169463c8125e07c577110fe144ecd63942eb9472d438fc0014f474245e5df8a1'});
12 }
13
14 function createAnotherPatch()
15 {
16     return UploadedFile.ensureSingleton(454, {'createdAt': new Date('2017-05-01T19:16:53Z'), 'filename': 'patch.dat', 'extension': '.dat', 'author': 'some user',
17         size: 534611, sha256: '169463c8125e07c577110fe144ecd63942eb9472d438fc0014f474245e5dfaaa'});
18 }
19
20 function createRoot()
21 {
22     return UploadedFile.ensureSingleton(456, {'createdAt': new Date('2017-05-01T21:03:27Z'), 'filename': 'root.dat', 'extension': '.dat', 'author': 'some user',
23         size: 16452234, sha256: '03eed7a8494ab8794c44b7d4308e55448fc56f4d6c175809ba968f78f656d58d'});
24 }
25
26 function createAnotherRoot()
27 {
28     return UploadedFile.ensureSingleton(457, {'createdAt': new Date('2017-05-01T21:03:27Z'), 'filename': 'root.dat', 'extension': '.dat', 'author': 'some user',
29         size: 16452111, sha256: '03eed7a8494ab8794c44b7d4308e55448fc56f4d6c175809ba968f78f656dbbb'});
30 }
31
32 function customCommitSetWithoutOwnedCommit()
33 {
34     const customCommitSet = new CustomCommitSet;
35     customCommitSet.setRevisionForRepository(MockModels.osx, '10.11.4 15E65');
36     customCommitSet.setRevisionForRepository(MockModels.webkit, '200805');
37     return customCommitSet;
38 }
39
40 function customCommitSetWithOwnedCommit()
41 {
42     const customCommitSet = new CustomCommitSet;
43     customCommitSet.setRevisionForRepository(MockModels.osx, '10.11.4 15E65');
44     customCommitSet.setRevisionForRepository(MockModels.ownerRepository, 'OwnerRepository-r0');
45     customCommitSet.setRevisionForRepository(MockModels.ownedRepository, 'OwnedRepository-r0', null, 'OwnerRepository-r0');
46     return customCommitSet;
47 }
48
49 function customCommitSetWithPatch()
50 {
51     const customCommitSet = new CustomCommitSet;
52     const patch = createPatch();
53     customCommitSet.setRevisionForRepository(MockModels.osx, '10.11.4 15E65');
54     customCommitSet.setRevisionForRepository(MockModels.webkit, '200805', patch);
55     return customCommitSet;
56 }
57
58 function customCommitSetWithOwnedRepositoryHasSameNameAsNotOwnedRepository()
59 {
60     const customCommitSet = new CustomCommitSet;
61     customCommitSet.setRevisionForRepository(MockModels.osx, '10.11.4 15E65');
62     customCommitSet.setRevisionForRepository(MockModels.webkit, '200805');
63     customCommitSet.setRevisionForRepository(MockModels.ownedWebkit, 'owned-200805', null, '10.11.4 15E65');
64     return customCommitSet;
65 }
66
67 function ownerCommit()
68 {
69     return CommitLog.ensureSingleton(5, {
70         repository: MockModels.ownerRepository,
71         revision: 'owner-commit-0',
72         ownsCommits: true,
73         time: null,
74     });
75 }
76
77 function partialOwnerCommit()
78 {
79     return CommitLog.ensureSingleton(5, {
80         repository: MockModels.ownerRepository,
81         revision: 'owner-commit-0',
82         ownsCommits: null,
83         time: +(new Date('2016-05-13T00:55:57.841344Z')),
84     });
85 }
86
87 function ownedCommit()
88 {
89     return new CommitLog(6, {
90         repository: MockModels.ownedRepository,
91         revision: 'owned-commit-0',
92         ownsCommits: null,
93         time: 1456932774000
94     });
95 }
96
97 function webkitCommit()
98 {
99     return CommitLog.ensureSingleton(2017, {
100         repository: MockModels.webkit,
101         revision: 'webkit-commit-0',
102         ownsCommits: false,
103         time: 1456932773000
104     });
105 }
106
107 describe('CommitSet', () => {
108     MockRemoteAPI.inject();
109     MockModels.inject();
110
111     function oneCommitSet()
112     {
113         return CommitSet.ensureSingleton(1, {
114             revisionItems: [{ commit: webkitCommit(), requiresBuild: false }],
115             customRoots: []
116         });
117     }
118
119     function anotherCommitSet()
120     {
121         return CommitSet.ensureSingleton(2, {
122             revisionItems: [{ commit: webkitCommit(), requiresBuild: false }],
123             customRoots: []
124         });
125     }
126
127     function commitSetWithPatch()
128     {
129         return CommitSet.ensureSingleton(3, {
130             revisionItems: [{ commit: webkitCommit(), requiresBuild: false, patch: createPatch() }],
131             customRoots: []
132         });
133     }
134
135     function commitSetWithAnotherPatch()
136     {
137         return CommitSet.ensureSingleton(4, {
138             revisionItems: [{ commit: webkitCommit(), requiresBuild: false, patch: createAnotherPatch() }],
139             customRoots: []
140         });
141     }
142
143     function commitSetWithRoot()
144     {
145         return CommitSet.ensureSingleton(5, {
146             revisionItems: [{ commit: webkitCommit(), requiresBuild: false }],
147             customRoots: [createRoot()]
148         });
149     }
150
151     function anotherCommitSetWithRoot()
152     {
153         return CommitSet.ensureSingleton(6, {
154             revisionItems: [{ commit: webkitCommit(), requiresBuild: false }],
155             customRoots: [createAnotherRoot()]
156         });
157     }
158
159     function oneMeasurementCommitSet()
160     {
161         return MeasurementCommitSet.ensureSingleton(1, [
162             [2017, 11, 'webkit-commit-0', 1456932773000]
163         ]);
164     }
165
166     describe('equals', () => {
167         it('should return false if patches for same repository are different', () => {
168             assert(!commitSetWithPatch().equals(commitSetWithAnotherPatch()));
169             assert(!commitSetWithAnotherPatch().equals(commitSetWithPatch()));
170         });
171
172         it('should return false if patch is only specified in one commit set', () => {
173             assert(!oneCommitSet().equals(commitSetWithPatch()));
174             assert(!commitSetWithPatch().equals(oneCommitSet()));
175         });
176
177         it('should return false if roots for same repository are different', () => {
178             assert(!commitSetWithRoot().equals(anotherCommitSetWithRoot()));
179             assert(!anotherCommitSetWithRoot().equals(commitSetWithRoot()));
180         });
181
182         it('should return false if root is only specified in one commit set', () => {
183             assert(!commitSetWithRoot().equals(oneCommitSet()));
184             assert(!oneCommitSet().equals(commitSetWithRoot()));
185         });
186
187         it('should return true when comparing two identical commit set', () => {
188             assert(oneCommitSet().equals(oneCommitSet()));
189             assert(anotherCommitSet().equals(anotherCommitSet()));
190             assert(commitSetWithPatch().equals(commitSetWithPatch()));
191             assert(commitSetWithAnotherPatch().equals(commitSetWithAnotherPatch()));
192             assert(oneMeasurementCommitSet().equals(oneMeasurementCommitSet()));
193             assert(commitSetWithRoot().equals(commitSetWithRoot()));
194             assert(anotherCommitSetWithRoot().equals(anotherCommitSetWithRoot()));
195         });
196
197         it('should be able to compare between CommitSet and MeasurementCommitSet', () => {
198             assert(oneCommitSet().equals(oneMeasurementCommitSet()));
199             assert(oneMeasurementCommitSet().equals(oneCommitSet()));
200         });
201     })
202 });
203
204 describe('IntermediateCommitSet', () => {
205     MockRemoteAPI.inject();
206     MockModels.inject();
207
208     describe('setCommitForRepository', () => {
209         it('should allow set commit for owner repository', () => {
210             const commitSet = new IntermediateCommitSet(new CommitSet);
211             const commit = ownerCommit();
212             commitSet.setCommitForRepository(MockModels.ownerRepository, commit);
213             assert.equal(commit, commitSet.commitForRepository(MockModels.ownerRepository));
214         });
215
216         it('should allow set commit for owned repository', () => {
217             const commitSet = new IntermediateCommitSet(new CommitSet);
218             const commit = ownerCommit();
219
220             const fetchingPromise = commit.fetchOwnedCommits();
221             const requests = MockRemoteAPI.requests;
222             assert.equal(requests.length, 1);
223             assert.equal(requests[0].url, '../api/commits/111/owned-commits?owner-revision=owner-commit-0');
224             assert.equal(requests[0].method, 'GET');
225
226             requests[0].resolve({commits: [{
227                 id: 233,
228                 repository: MockModels.ownedRepository.id(),
229                 revision: '6f8b0dbbda95a440503b88db1dd03dad3a7b07fb',
230                 time: +(new Date('2016-05-13T00:55:57.841344Z')),
231             }]});
232
233             return fetchingPromise.then(() => {
234                 const ownedCommit = commit.ownedCommits()[0];
235                 commitSet.setCommitForRepository(MockModels.ownerRepository, commit);
236                 commitSet.setCommitForRepository(MockModels.ownedRepository, ownedCommit);
237                 assert.equal(commit, commitSet.commitForRepository(MockModels.ownerRepository));
238                 assert.equal(ownedCommit, commitSet.commitForRepository(MockModels.ownedRepository));
239                 assert.deepEqual(commitSet.repositories(), [MockModels.ownerRepository, MockModels.ownedRepository]);
240             });
241         });
242     });
243
244     describe('fetchCommitLogs', () => {
245
246         it('should fetch CommitLog object with owned commits information',  () => {
247             const commit = partialOwnerCommit();
248             assert.equal(commit.ownsCommits(), null);
249             const owned = ownedCommit();
250
251             const commitSet = CommitSet.ensureSingleton('53246456', {revisionItems: [{commit}, {commit: owned, ownerCommit: commit}]});
252             const intermediateCommitSet =new IntermediateCommitSet(commitSet);
253             const fetchingPromise = intermediateCommitSet.fetchCommitLogs();
254
255             const requests = MockRemoteAPI.requests;
256             assert.equal(requests.length, 2);
257             assert.equal(requests[0].url, '/api/commits/111/owner-commit-0');
258             assert.equal(requests[0].method, 'GET');
259             assert.equal(requests[1].url, '/api/commits/112/owned-commit-0');
260             assert.equal(requests[1].method, 'GET');
261
262             requests[0].resolve({commits: [{
263                 id: 5,
264                 repository: MockModels.ownerRepository,
265                 revision: 'owner-commit-0',
266                 ownsCommits: true,
267                 time: +(new Date('2016-05-13T00:55:57.841344Z')),
268             }]});
269             requests[1].resolve({commits: [{
270                 id: 6,
271                 repository: MockModels.ownedRepository,
272                 revision: 'owned-commit-0',
273                 ownsCommits: false,
274                 time: 1456932774000,
275             }]});
276
277             return MockRemoteAPI.waitForRequest().then(() => {
278                 assert.equal(requests.length, 3);
279                 assert.equal(requests[2].url, '../api/commits/111/owned-commits?owner-revision=owner-commit-0');
280                 assert.equal(requests[2].method, 'GET');
281
282                 requests[2].resolve({commits: [{
283                     id: 6,
284                     repository: MockModels.ownedRepository.id(),
285                     revision: 'owned-commit-0',
286                     ownsCommits: false,
287                     time: 1456932774000,
288                 }]});
289                 return fetchingPromise;
290             }).then(() => {
291                 assert(commit.ownsCommits());
292                 assert.equal(commit.ownedCommits().length, 1);
293                 assert.equal(commit.ownedCommits()[0], owned);
294                 assert.equal(owned.ownerCommit(), commit);
295                 assert.equal(owned.repository(), MockModels.ownedRepository);
296                 assert.equal(intermediateCommitSet.commitForRepository(MockModels.ownedRepository), owned);
297                 assert.equal(intermediateCommitSet.ownerCommitForRepository(MockModels.ownedRepository), commit);
298                 assert.deepEqual(intermediateCommitSet.repositories(), [MockModels.ownerRepository, MockModels.ownedRepository]);
299             });
300         });
301     });
302
303     describe('updateRevisionForOwnerRepository', () => {
304
305         it('should update CommitSet based on the latest invocation', () => {
306             const commitSet = new IntermediateCommitSet(new CommitSet);
307             const firstUpdatePromise = commitSet.updateRevisionForOwnerRepository(MockModels.webkit, 'webkit-commit-0');
308             const secondUpdatePromise = commitSet.updateRevisionForOwnerRepository(MockModels.webkit, 'webkit-commit-1');
309             const requests = MockRemoteAPI.requests;
310
311             assert(requests.length, 2);
312             assert.equal(requests[0].url, '/api/commits/11/webkit-commit-0');
313             assert.equal(requests[0].method, 'GET');
314             assert.equal(requests[1].url, '/api/commits/11/webkit-commit-1');
315             assert.equal(requests[1].method, 'GET');
316
317             requests[1].resolve({commits: [{
318                 id: 2018,
319                 repository: MockModels.webkit.id(),
320                 revision: 'webkit-commit-1',
321                 ownsCommits: false,
322                 time: 1456932774000,
323             }]});
324
325             let commit = null;
326             return secondUpdatePromise.then(() => {
327                 commit = commitSet.commitForRepository(MockModels.webkit);
328
329                 requests[0].resolve({commits: [{
330                     id: 2017,
331                     repository: MockModels.webkit.id(),
332                     revision: 'webkit-commit-0',
333                     ownsCommits: false,
334                     time: 1456932773000,
335                 }]});
336
337                 assert.equal(commit.revision(), 'webkit-commit-1');
338                 assert.equal(commit.id(), 2018);
339
340                 return firstUpdatePromise;
341             }).then(() => {
342                 const currentCommit = commitSet.commitForRepository(MockModels.webkit);
343                 assert.equal(commit, currentCommit);
344             });
345         });
346
347     });
348
349     describe('removeCommitForRepository', () => {
350         it('should remove owned commits when owner commit is removed', () => {
351             const commitSet = new IntermediateCommitSet(new CommitSet);
352             const commit = ownerCommit();
353
354             const fetchingPromise = commit.fetchOwnedCommits();
355             const requests = MockRemoteAPI.requests;
356             assert.equal(requests.length, 1);
357             assert.equal(requests[0].url, '../api/commits/111/owned-commits?owner-revision=owner-commit-0');
358             assert.equal(requests[0].method, 'GET');
359
360             requests[0].resolve({commits: [{
361                 id: 233,
362                 repository: MockModels.ownedRepository.id(),
363                 revision: '6f8b0dbbda95a440503b88db1dd03dad3a7b07fb',
364                 ownsCommits: true
365             }]});
366
367             return fetchingPromise.then(() => {
368                 commitSet.setCommitForRepository(MockModels.ownerRepository, commit);
369                 commitSet.setCommitForRepository(MockModels.ownedRepository, commit.ownedCommits()[0]);
370                 commitSet.removeCommitForRepository(MockModels.ownerRepository);
371                 assert.deepEqual(commitSet.repositories(), []);
372             });
373         });
374
375         it('should not remove owner commits when owned commit is removed', () => {
376             const commitSet = new IntermediateCommitSet(new CommitSet);
377             const commit = ownerCommit();
378
379             const fetchingPromise = commit.fetchOwnedCommits();
380             const requests = MockRemoteAPI.requests;
381             assert.equal(requests.length, 1);
382             assert.equal(requests[0].url, '../api/commits/111/owned-commits?owner-revision=owner-commit-0');
383             assert.equal(requests[0].method, 'GET');
384
385             requests[0].resolve({commits: [{
386                 id: 233,
387                 repository: MockModels.ownedRepository.id(),
388                 revision: '6f8b0dbbda95a440503b88db1dd03dad3a7b07fb',
389                 time: +(new Date('2016-05-13T00:55:57.841344Z')),
390             }]});
391
392             return fetchingPromise.then(() => {
393                 commitSet.setCommitForRepository(MockModels.ownerRepository, commit);
394                 commitSet.setCommitForRepository(MockModels.ownedRepository, commit.ownedCommits()[0]);
395                 commitSet.removeCommitForRepository(MockModels.ownedRepository);
396                 assert.deepEqual(commitSet.repositories(), [MockModels.ownerRepository]);
397             });
398         });
399
400         it('should not update commit set for repository if removeCommitForRepository called before updateRevisionForOwnerRepository finishes', () => {
401             const commitSet = new IntermediateCommitSet(new CommitSet);
402             const commit = webkitCommit();
403             commitSet.setCommitForRepository(MockModels.webkit, commit);
404             const updatePromise = commitSet.updateRevisionForOwnerRepository(MockModels.webkit, 'webkit-commit-1');
405
406             commitSet.removeCommitForRepository(MockModels.webkit);
407
408             const requests = MockRemoteAPI.requests;
409             assert.equal(requests[0].url, '/api/commits/11/webkit-commit-1');
410             assert.equal(requests[0].method, 'GET');
411
412             requests[0].resolve({commits: [{
413                 id: 2018,
414                 repository: MockModels.webkit.id(),
415                 revision: 'webkit-commit-1',
416                 ownsCommits: false,
417                 time: 1456932774000,
418             }]});
419
420             return updatePromise.then(() => {
421                 assert.deepEqual(commitSet.repositories(), []);
422                 assert(!commitSet.commitForRepository(MockModels.webkit));
423             });
424         });
425
426     });
427
428 });
429
430 describe('CustomCommitSet', () => {
431     MockModels.inject();
432
433     describe('Test custom commit set without owned commit', () => {
434         it('should have right revision for a given repository', () => {
435             const commitSet = customCommitSetWithoutOwnedCommit();
436             assert.equal(commitSet.revisionForRepository(MockModels.osx), '10.11.4 15E65');
437             assert.equal(commitSet.revisionForRepository(MockModels.webkit), '200805');
438         });
439
440         it('should have no patch for any repository', () => {
441             const commitSet = customCommitSetWithoutOwnedCommit();
442             assert.equal(commitSet.patchForRepository(MockModels.osx), null);
443             assert.equal(commitSet.patchForRepository(MockModels.webkit), null);
444         });
445
446         it('should have no owner revision for a given repository', () => {
447             const commitSet = customCommitSetWithoutOwnedCommit();
448             assert.equal(commitSet.ownerRevisionForRepository(MockModels.osx), null);
449             assert.equal(commitSet.ownerRevisionForRepository(MockModels.webkit), null);
450         });
451
452         it('should return all repositories in it', () => {
453             const commitSet = customCommitSetWithoutOwnedCommit();
454             assert.deepEqual(commitSet.repositories(), [MockModels.osx, MockModels.webkit]);
455         });
456
457         it('should return only top level repositories', () => {
458             const commitSet = customCommitSetWithoutOwnedCommit();
459             assert.deepEqual(commitSet.topLevelRepositories(), [MockModels.osx, MockModels.webkit]);
460         });
461     });
462
463     describe('Test custom commit set with owned commit', () => {
464         it('should have right revision for a given repository', () => {
465             const commitSet = customCommitSetWithOwnedCommit();
466             assert.equal(commitSet.revisionForRepository(MockModels.osx), '10.11.4 15E65');
467             assert.equal(commitSet.revisionForRepository(MockModels.ownerRepository), 'OwnerRepository-r0');
468             assert.equal(commitSet.revisionForRepository(MockModels.ownedRepository), 'OwnedRepository-r0');
469         });
470
471         it('should have no patch for any repository', () => {
472             const commitSet = customCommitSetWithOwnedCommit();
473             assert.equal(commitSet.patchForRepository(MockModels.osx), null);
474             assert.equal(commitSet.patchForRepository(MockModels.ownerRepository), null);
475             assert.equal(commitSet.patchForRepository(MockModels.ownedRepository), null);
476         });
477
478         it('should have right owner revision for an owned repository', () => {
479             const commitSet = customCommitSetWithOwnedCommit();
480             assert.equal(commitSet.ownerRevisionForRepository(MockModels.osx), null);
481             assert.equal(commitSet.ownerRevisionForRepository(MockModels.ownerRepository), null);
482             assert.equal(commitSet.ownerRevisionForRepository(MockModels.ownedRepository), 'OwnerRepository-r0');
483         });
484
485         it('should return all repositories in it', () => {
486             const commitSet = customCommitSetWithOwnedCommit();
487             assert.deepEqual(commitSet.repositories(), [MockModels.osx, MockModels.ownerRepository, MockModels.ownedRepository]);
488         });
489
490         it('should return only top level repositories', () => {
491             const commitSet = customCommitSetWithOwnedCommit();
492             assert.deepEqual(commitSet.topLevelRepositories(), [MockModels.osx, MockModels.ownerRepository]);
493         });
494     });
495
496     describe('Test custom commit set with patch', () => {
497         it('should have right revision for a given repository', () => {
498             const commitSet = customCommitSetWithPatch();
499             assert.equal(commitSet.revisionForRepository(MockModels.osx), '10.11.4 15E65');
500             assert.equal(commitSet.revisionForRepository(MockModels.webkit), '200805');
501         });
502
503         it('should have a patch for a repository with patch specified', () => {
504             const commitSet = customCommitSetWithPatch();
505             assert.equal(commitSet.patchForRepository(MockModels.osx), null);
506             assert.deepEqual(commitSet.patchForRepository(MockModels.webkit), createPatch());
507         });
508
509         it('should have no owner revision for a given repository', () => {
510             const commitSet = customCommitSetWithPatch();
511             assert.equal(commitSet.ownerRevisionForRepository(MockModels.osx), null);
512             assert.equal(commitSet.ownerRevisionForRepository(MockModels.webkit), null);
513         });
514
515         it('should return all repositories in it', () => {
516             const commitSet = customCommitSetWithPatch();
517             assert.deepEqual(commitSet.repositories(), [MockModels.osx, MockModels.webkit]);
518         });
519
520         it('should return only top level repositories', () => {
521             const commitSet = customCommitSetWithPatch();
522             assert.deepEqual(commitSet.topLevelRepositories(), [MockModels.osx, MockModels.webkit]);
523         });
524     });
525
526     describe('Test custom commit set with owned repository has same name as non-owned repository',  () => {
527         it('should have right revision for a given repository', () => {
528             const commitSet = customCommitSetWithOwnedRepositoryHasSameNameAsNotOwnedRepository();
529             assert.equal(commitSet.revisionForRepository(MockModels.osx), '10.11.4 15E65');
530             assert.equal(commitSet.revisionForRepository(MockModels.webkit), '200805');
531             assert.equal(commitSet.revisionForRepository(MockModels.ownedWebkit), 'owned-200805');
532         });
533
534         it('should have no patch for any repository', () => {
535             const commitSet = customCommitSetWithOwnedRepositoryHasSameNameAsNotOwnedRepository();
536             assert.equal(commitSet.patchForRepository(MockModels.osx), null);
537             assert.equal(commitSet.patchForRepository(MockModels.webkit), null);
538             assert.equal(commitSet.patchForRepository(MockModels.ownedWebkit), null);
539         });
540
541         it('should have right owner revision for an owned repository', () => {
542             const commitSet = customCommitSetWithOwnedRepositoryHasSameNameAsNotOwnedRepository();
543             assert.equal(commitSet.ownerRevisionForRepository(MockModels.osx), null);
544             assert.equal(commitSet.ownerRevisionForRepository(MockModels.webkit), null);
545             assert.equal(commitSet.ownerRevisionForRepository(MockModels.ownedWebkit), '10.11.4 15E65');
546         });
547
548         it('should return all repositories in it', () => {
549             const commitSet = customCommitSetWithOwnedRepositoryHasSameNameAsNotOwnedRepository();
550             assert.deepEqual(commitSet.repositories(), [MockModels.osx, MockModels.webkit, MockModels.ownedWebkit]);
551         });
552
553         it('should return only top level repositories', () => {
554             const commitSet = customCommitSetWithOwnedRepositoryHasSameNameAsNotOwnedRepository();
555             assert.deepEqual(commitSet.topLevelRepositories(), [MockModels.osx, MockModels.webkit]);
556         });
557     });
558
559     describe('Test custom commit set equality function', () => {
560         it('should be equal to same custom commit set', () => {
561             assert.deepEqual(customCommitSetWithoutOwnedCommit(), customCommitSetWithoutOwnedCommit());
562             assert.deepEqual(customCommitSetWithOwnedCommit(), customCommitSetWithOwnedCommit());
563             assert.deepEqual(customCommitSetWithPatch(), customCommitSetWithPatch());
564             assert.deepEqual(customCommitSetWithOwnedRepositoryHasSameNameAsNotOwnedRepository(),
565                 customCommitSetWithOwnedRepositoryHasSameNameAsNotOwnedRepository());
566         });
567
568         it('should not be equal even if non-owned revisions are the same', () => {
569             const commitSet0 = customCommitSetWithoutOwnedCommit();
570             const commitSet1 = customCommitSetWithOwnedRepositoryHasSameNameAsNotOwnedRepository();
571             assert.equal(commitSet0.equals(commitSet1), false);
572         });
573     });
574
575     describe('Test custom commit set custom root operations', () => {
576         it('should return empty custom roots if no custom root specified', () => {
577             assert.deepEqual(customCommitSetWithoutOwnedCommit().customRoots(), []);
578         });
579
580         it('should return root if root is added into commit set', () => {
581             const commitSet = customCommitSetWithoutOwnedCommit();
582             commitSet.addCustomRoot(createRoot());
583             assert.deepEqual(commitSet.customRoots(), [createRoot()]);
584         });
585     });
586 });