| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 import 'package:scheduled_test/scheduled_test.dart'; | 5 import 'package:scheduled_test/scheduled_test.dart'; |
| 6 | 6 |
| 7 import '../../descriptor.dart' as d; | 7 import '../../descriptor.dart' as d; |
| 8 import '../../test_pub.dart'; | 8 import '../../test_pub.dart'; |
| 9 | 9 |
| 10 main() { | 10 main() { |
| 11 integration('does not request versions if the lockfile is up to date', () { | 11 integration('does not request versions if the lockfile is up to date', () { |
| 12 servePackages((builder) { | 12 servePackages((builder) { |
| 13 builder.serve("foo", "1.0.0"); | 13 builder.serve("foo", "1.0.0"); |
| 14 builder.serve("foo", "1.1.0"); | 14 builder.serve("foo", "1.1.0"); |
| 15 builder.serve("foo", "1.2.0"); | 15 builder.serve("foo", "1.2.0"); |
| 16 }); | 16 }); |
| 17 | 17 |
| 18 d.appDir({ | 18 d.appDir({ |
| 19 "foo": "any" | 19 "foo": "any" |
| 20 }).create(); | 20 }).create(); |
| 21 | 21 |
| 22 // Get once so it gets cached. | 22 // Get once so it gets cached. |
| 23 pubGet(); | 23 pubGet(); |
| 24 | 24 |
| 25 // Clear the cache. We don't care about anything that was served during | 25 // Clear the cache. We don't care about anything that was served during |
| 26 // the initial get. | 26 // the initial get. |
| 27 getRequestedPaths(); | 27 globalServer.clearRequestedPaths(); |
| 28 | 28 |
| 29 // Run the solver again now that it's cached. | 29 // Run the solver again now that it's cached. |
| 30 pubGet(); | 30 pubGet(); |
| 31 | 31 |
| 32 d.cacheDir({"foo": "1.2.0"}).validate(); | 32 d.cacheDir({"foo": "1.2.0"}).validate(); |
| 33 d.packagesDir({"foo": "1.2.0"}).validate(); | 33 d.packagesDir({"foo": "1.2.0"}).validate(); |
| 34 | 34 |
| 35 // The get should not have done any network requests since the lock file is | 35 // The get should not have done any network requests since the lock file is |
| 36 // up to date. | 36 // up to date. |
| 37 getRequestedPaths().then((paths) { | 37 globalServer.requestedPaths.then((paths) { |
| 38 expect(paths, isEmpty); | 38 expect(paths, isEmpty); |
| 39 }); | 39 }); |
| 40 }); | 40 }); |
| 41 } | 41 } |
| OLD | NEW |