| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 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. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 library barback.test.barback_test; | 5 library barback.test.barback_test; |
| 6 | 6 |
| 7 import 'dart:async'; | |
| 8 | |
| 9 import 'package:barback/barback.dart'; | |
| 10 import 'package:scheduled_test/scheduled_test.dart'; | 7 import 'package:scheduled_test/scheduled_test.dart'; |
| 11 | 8 |
| 12 import '../utils.dart'; | 9 import '../utils.dart'; |
| 13 | 10 |
| 14 main() { | 11 main() { |
| 15 initConfig(); | 12 initConfig(); |
| 16 | 13 |
| 17 test("gets all source assets", () { | 14 test("gets all source assets", () { |
| 18 initGraph(["app|a.txt", "app|b.txt", "app|c.txt"]); | 15 initGraph(["app|a.txt", "app|b.txt", "app|c.txt"]); |
| 19 updateSources(["app|a.txt", "app|b.txt", "app|c.txt"]); | 16 updateSources(["app|a.txt", "app|b.txt", "app|c.txt"]); |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 new BadTransformer(["app|foo.out2"]) | 67 new BadTransformer(["app|foo.out2"]) |
| 71 ] | 68 ] |
| 72 ]}); | 69 ]}); |
| 73 | 70 |
| 74 updateSources(["app|foo.txt"]); | 71 updateSources(["app|foo.txt"]); |
| 75 expectAllAssetsShouldFail(isAggregateException([ | 72 expectAllAssetsShouldFail(isAggregateException([ |
| 76 isTransformerException(equals(BadTransformer.ERROR)), | 73 isTransformerException(equals(BadTransformer.ERROR)), |
| 77 isTransformerException(equals(BadTransformer.ERROR)) | 74 isTransformerException(equals(BadTransformer.ERROR)) |
| 78 ])); | 75 ])); |
| 79 }); | 76 }); |
| 80 | |
| 81 // Regression test. | |
| 82 test("getAllAssets() is called synchronously after after initializing " | |
| 83 "barback", () { | |
| 84 var provider = new MockProvider({ | |
| 85 "app|a.txt": "a", | |
| 86 "app|b.txt": "b", | |
| 87 "app|c.txt": "c" | |
| 88 }); | |
| 89 var barback = new Barback(provider); | |
| 90 barback.updateSources([ | |
| 91 new AssetId.parse("app|a.txt"), | |
| 92 new AssetId.parse("app|b.txt"), | |
| 93 new AssetId.parse("app|c.txt") | |
| 94 ]); | |
| 95 | |
| 96 expect(barback.getAllAssets().then((assets) { | |
| 97 return Future.wait(assets.map((asset) => asset.readAsString())); | |
| 98 }), completion(unorderedEquals(["a", "b", "c"]))); | |
| 99 }); | |
| 100 } | 77 } |
| OLD | NEW |