OLD | NEW |
(Empty) | |
| 1 library pub_tests; |
| 2 import 'dart:async'; |
| 3 import 'package:scheduled_test/scheduled_test.dart'; |
| 4 import '../../descriptor.dart' as d; |
| 5 import '../../test_pub.dart'; |
| 6 import '../utils.dart'; |
| 7 main() { |
| 8 initConfig(); |
| 9 integration( |
| 10 "binds a directory to a new port and immediately unbinds that " "directory
", |
| 11 () { |
| 12 d.dir( |
| 13 appPath, |
| 14 [ |
| 15 d.appPubspec(), |
| 16 d.dir("test", [d.file("index.html", "<test body>")]), |
| 17 d.dir("web", [d.file("index.html", "<body>")])]).create(); |
| 18 pubServe(args: ["web"]); |
| 19 var serveRequest = webSocketRequest("serveDirectory", { |
| 20 "path": "test" |
| 21 }); |
| 22 var unserveRequest = webSocketRequest("unserveDirectory", { |
| 23 "path": "test" |
| 24 }); |
| 25 schedule(() { |
| 26 return Future.wait([serveRequest, unserveRequest]).then((results) { |
| 27 expect(results[0], contains("result")); |
| 28 expect(results[1], contains("result")); |
| 29 expect(results[0]["result"]["url"], matches(r"http://localhost:\d+")); |
| 30 expect(results[0]["result"], equals(results[1]["result"])); |
| 31 }); |
| 32 }); |
| 33 endPubServe(); |
| 34 }); |
| 35 } |
OLD | NEW |