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("foo", [ | |
17 d.libPubspec("foo", "0.0.1"), | |
18 d.dir("lib", [ | |
19 d.file("foo.dart", "foo") | |
20 ]) | |
21 ]).create(); | |
22 | |
23 d.dir(appPath, [ | |
24 d.appPubspec({ | |
25 "foo": {"path": "../foo"} | |
26 }), | |
27 d.dir("lib", [ | |
28 d.file("myapp.dart", "myapp"), | |
29 ]), | |
30 d.dir("test", [ | |
31 d.file("index.html", "<body>"), | |
32 d.dir("sub", [ | |
33 d.file("bar.html", "bar"), | |
34 ]) | |
35 ]), | |
36 d.dir("web", [ | |
37 d.file("index.html", "<body>"), | |
38 d.dir("sub", [ | |
39 d.file("bar.html", "bar"), | |
40 ]) | |
41 ]) | |
42 ]).create(); | |
43 }); | |
44 | |
45 integration("converts URLs to matching asset ids in web/", () { | |
46 pubServe(shouldGetFirst: true); | |
47 expectWebSocketResult("urlToAssetId", { | |
48 "url": getServerUrl("web", "index.html") | |
49 }, {"package": "myapp", "path": "web/index.html"}); | |
50 endPubServe(); | |
51 }); | |
52 | |
53 integration("converts URLs to matching asset ids in subdirectories of web/", | |
54 () { | |
55 pubServe(shouldGetFirst: true); | |
56 expectWebSocketResult("urlToAssetId", { | |
57 "url": getServerUrl("web", "sub/bar.html") | |
58 }, {"package": "myapp", "path": "web/sub/bar.html"}); | |
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 }, {"package": "myapp", "path": "test/index.html"}); | |
67 endPubServe(); | |
68 }); | |
69 | |
70 integration("converts URLs to matching asset ids in subdirectories of test/", | |
71 () { | |
72 pubServe(shouldGetFirst: true); | |
73 expectWebSocketResult("urlToAssetId", { | |
74 "url": getServerUrl("test", "sub/bar.html") | |
75 }, {"package": "myapp", "path": "test/sub/bar.html"}); | |
76 endPubServe(); | |
77 }); | |
78 | |
79 integration("converts URLs to matching asset ids in the entrypoint's lib/", | |
80 () { | |
81 // Path in root package's lib/. | |
82 pubServe(shouldGetFirst: true); | |
83 expectWebSocketResult("urlToAssetId", { | |
84 "url": getServerUrl("web", "packages/myapp/myapp.dart") | |
85 }, {"package": "myapp", "path": "lib/myapp.dart"}); | |
86 endPubServe(); | |
87 }); | |
88 | |
89 integration("converts URLs to matching asset ids in a dependency's lib/", () { | |
90 // Path in lib/. | |
91 pubServe(shouldGetFirst: true); | |
92 expectWebSocketResult("urlToAssetId", { | |
93 "url": getServerUrl("web", "packages/foo/foo.dart") | |
94 }, {"package": "foo", "path": "lib/foo.dart"}); | |
95 endPubServe(); | |
96 }); | |
97 } | |
OLD | NEW |