OLD | NEW |
| (Empty) |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS d.file | |
2 // for details. All rights reserved. Use of this source code is governed by a | |
3 // BSD-style license that can be found in the LICENSE file. | |
4 | |
5 library pub_tests; | |
6 | |
7 import 'package:scheduled_test/scheduled_test.dart'; | |
8 import '../../descriptor.dart' as d; | |
9 import '../../test_pub.dart'; | |
10 import '../utils.dart'; | |
11 | |
12 main() { | |
13 // TODO(rnystrom): Split into independent tests. | |
14 initConfig(); | |
15 setUp(() { | |
16 d.dir( | |
17 "foo", | |
18 [ | |
19 d.libPubspec("foo", "0.0.1"), | |
20 d.dir("lib", [d.file("foo.dart", "foo")])]).create(); | |
21 | |
22 d.dir(appPath, [d.appPubspec({ | |
23 "foo": { | |
24 "path": "../foo" | |
25 } | |
26 }), | |
27 d.dir("lib", [d.file("myapp.dart", "myapp"),]), | |
28 d.dir( | |
29 "test", | |
30 [d.file("index.html", "<body>"), d.dir("sub", [d.file("bar.html",
"bar"),])]), | |
31 d.dir( | |
32 "web", | |
33 [ | |
34 d.file("index.html", "<body>"), | |
35 d.dir("sub", [d.file("bar.html", "bar"),])])]).create(); | |
36 }); | |
37 | |
38 integration("converts URLs to matching asset ids in web/", () { | |
39 pubServe(shouldGetFirst: true); | |
40 expectWebSocketResult("urlToAssetId", { | |
41 "url": getServerUrl("web", "index.html") | |
42 }, { | |
43 "package": "myapp", | |
44 "path": "web/index.html" | |
45 }); | |
46 endPubServe(); | |
47 }); | |
48 | |
49 integration( | |
50 "converts URLs to matching asset ids in subdirectories of web/", | |
51 () { | |
52 pubServe(shouldGetFirst: true); | |
53 expectWebSocketResult("urlToAssetId", { | |
54 "url": getServerUrl("web", "sub/bar.html") | |
55 }, { | |
56 "package": "myapp", | |
57 "path": "web/sub/bar.html" | |
58 }); | |
59 endPubServe(); | |
60 }); | |
61 | |
62 integration("converts URLs to matching asset ids in test/", () { | |
63 pubServe(shouldGetFirst: true); | |
64 expectWebSocketResult("urlToAssetId", { | |
65 "url": getServerUrl("test", "index.html") | |
66 }, { | |
67 "package": "myapp", | |
68 "path": "test/index.html" | |
69 }); | |
70 endPubServe(); | |
71 }); | |
72 | |
73 integration( | |
74 "converts URLs to matching asset ids in subdirectories of test/", | |
75 () { | |
76 pubServe(shouldGetFirst: true); | |
77 expectWebSocketResult("urlToAssetId", { | |
78 "url": getServerUrl("test", "sub/bar.html") | |
79 }, { | |
80 "package": "myapp", | |
81 "path": "test/sub/bar.html" | |
82 }); | |
83 endPubServe(); | |
84 }); | |
85 | |
86 integration( | |
87 "converts URLs to matching asset ids in the entrypoint's lib/", | |
88 () { | |
89 // Path in root package's lib/. | |
90 pubServe(shouldGetFirst: true); | |
91 expectWebSocketResult("urlToAssetId", { | |
92 "url": getServerUrl("web", "packages/myapp/myapp.dart") | |
93 }, { | |
94 "package": "myapp", | |
95 "path": "lib/myapp.dart" | |
96 }); | |
97 endPubServe(); | |
98 }); | |
99 | |
100 integration("converts URLs to matching asset ids in a dependency's lib/", () { | |
101 // Path in lib/. | |
102 pubServe(shouldGetFirst: true); | |
103 expectWebSocketResult("urlToAssetId", { | |
104 "url": getServerUrl("web", "packages/foo/foo.dart") | |
105 }, { | |
106 "package": "foo", | |
107 "path": "lib/foo.dart" | |
108 }); | |
109 endPubServe(); | |
110 }); | |
111 } | |
OLD | NEW |