OLD | NEW |
1 "use strict"; | 1 "use strict"; |
2 | 2 |
3 describe("PatchSet", function() { | 3 describe("PatchSet", function() { |
4 var assert = chai.assert; | 4 var assert = chai.assert; |
5 | 5 |
6 it("should sort headers before implementation files", function() { | 6 function assertSortedNames(inputNames, sortedNames) { |
| 7 var files = {}; |
| 8 inputNames.forEach(function(name) { |
| 9 files[name] = {}; |
| 10 }); |
7 var patchset = new PatchSet(new Issue(1), 2); | 11 var patchset = new PatchSet(new Issue(1), 2); |
8 patchset.parseData({ | 12 patchset.parseData({ |
9 issue: 1, | 13 issue: 1, |
10 patchset: 2, | 14 patchset: 2, |
11 files: { | 15 files: files, |
12 "Source/rendering/FrameView.h": {}, | |
13 "Source/frame/Frame.cpp": {}, | |
14 "Source/core/Document.cpp": {}, | |
15 "LayoutTests/foo/bar.js": {}, | |
16 "Source/core/DocumentImplementation.h": {}, | |
17 "Source/frame/Frame.h": {}, | |
18 "LayoutTests/foo/bar.html": {}, | |
19 "Source/rendering/FrameView.cpph": {}, | |
20 "Source/rendering/FrameView.cpp": {}, | |
21 "public/rendering/FrameView.cpp": {}, | |
22 "LayoutTests/foo/ack.html": {}, | |
23 "Source/rendering/FrameView.html": {}, | |
24 "Source/core/Document.h": {}, | |
25 }, | |
26 }); | 16 }); |
27 var fileNames = patchset.files.map(function(file) { | 17 var actualNames = patchset.files.map(function(file) { |
28 return file.name; | 18 return file.name; |
29 }); | 19 }); |
30 assert.deepEqual(fileNames, [ | 20 assert.deepEqual(actualNames, sortedNames); |
| 21 } |
| 22 |
| 23 it("should sort headers before implementation files", function() { |
| 24 assertSortedNames([ |
| 25 "Source/rendering/FrameView.hpp", |
| 26 "Source/frame/Frame.cpp", |
| 27 "Source/core/Document.cpp", |
| 28 "LayoutTests/foo/bar.js", |
| 29 "Source/core/DocumentImplementation.h", |
| 30 "Source/frame/Frame.h", |
| 31 "LayoutTests/foo/bar.html", |
| 32 "Source/rendering/FrameView.cpph", |
| 33 "Source/rendering/FrameView.cpp", |
| 34 "public/rendering/FrameView.cpp", |
| 35 "LayoutTests/foo/ack.html", |
| 36 "LayoutTests/foo/bar.hxx", |
| 37 "Source/rendering/FrameView.html", |
| 38 "Source/core/Document.h", |
| 39 ], [ |
31 "public/rendering/FrameView.cpp", | 40 "public/rendering/FrameView.cpp", |
32 "Source/core/Document.h", | 41 "Source/core/Document.h", |
33 "Source/core/Document.cpp", | 42 "Source/core/Document.cpp", |
34 "Source/core/DocumentImplementation.h", | 43 "Source/core/DocumentImplementation.h", |
35 "Source/frame/Frame.h", | 44 "Source/frame/Frame.h", |
36 "Source/frame/Frame.cpp", | 45 "Source/frame/Frame.cpp", |
| 46 "Source/rendering/FrameView.hpp", |
| 47 "Source/rendering/FrameView.cpp", |
37 "Source/rendering/FrameView.cpph", | 48 "Source/rendering/FrameView.cpph", |
38 "Source/rendering/FrameView.h", | |
39 "Source/rendering/FrameView.cpp", | |
40 "Source/rendering/FrameView.html", | 49 "Source/rendering/FrameView.html", |
41 "LayoutTests/foo/ack.html", | 50 "LayoutTests/foo/ack.html", |
42 "LayoutTests/foo/bar.html", | 51 "LayoutTests/foo/bar.html", |
| 52 "LayoutTests/foo/bar.h", |
43 "LayoutTests/foo/bar.js", | 53 "LayoutTests/foo/bar.js", |
44 ]); | 54 ]); |
45 }); | 55 }); |
| 56 |
| 57 it.only("should sort files without extensions", function() { |
| 58 assertSortedNames([ |
| 59 "chrome/chrome_tests_unit.gypi", |
| 60 "components/webdata/DEPS", |
| 61 "components/webdata_services/DEPS", |
| 62 "components/components.gyp", |
| 63 "chrome/browser/sync/profile_sync_service_autofill_unittest.a", |
| 64 "components/webdata_services/web_data_service_test_util.cc", |
| 65 "chrome/browser/BUILD.gn", |
| 66 "components/webdata_services/web_data_service_wrapper.cc", |
| 67 "components/webdata_services/web_data_service_test_util.h", |
| 68 "components/OWNERS", |
| 69 "components/autofill/core/browser/DEPS", |
| 70 "components/webdata/common/web_data_service_test_util.cc", |
| 71 "chrome/browser/DEPS", |
| 72 "components/webdata_services/BUILD.gn", |
| 73 "chrome/browser/webdata/web_data_service_factory.h", |
| 74 ], [ |
| 75 "chrome/browser/BUILD.gn", |
| 76 "chrome/browser/DEPS", |
| 77 "chrome/browser/sync/profile_sync_service_autofill_unittest.a", |
| 78 "chrome/browser/webdata/web_data_service_factory.h", |
| 79 "chrome/chrome_tests_unit.gypi", |
| 80 "components/autofill/core/browser/DEPS", |
| 81 "components/components.gyp", |
| 82 "components/OWNERS", |
| 83 "components/webdata_services/BUILD.gn", |
| 84 "components/webdata_services/DEPS", |
| 85 "components/webdata_services/web_data_service_test_util.h", |
| 86 "components/webdata_services/web_data_service_test_util.cc", |
| 87 "components/webdata_services/web_data_service_wrapper.cc", |
| 88 "components/webdata/common/web_data_service_test_util.cc", |
| 89 "components/webdata/DEPS", |
| 90 ]); |
| 91 }); |
46 }); | 92 }); |
OLD | NEW |