| 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 import 'dart:async'; | 5 import 'dart:async'; |
| 6 import 'dart:json' as json; | 6 import 'dart:json' as json; |
| 7 | 7 |
| 8 import 'package:http/http.dart' as http; | 8 import 'package:http/http.dart' as http; |
| 9 import 'package:http/testing.dart'; | 9 import 'package:http/testing.dart'; |
| 10 import 'package:path/path.dart' as path; | 10 import 'package:path/path.dart' as path; |
| 11 import 'package:scheduled_test/scheduled_test.dart'; | 11 import 'package:scheduled_test/scheduled_test.dart'; |
| 12 | 12 |
| 13 import '../../lib/src/entrypoint.dart'; | 13 import '../../lib/src/entrypoint.dart'; |
| 14 import '../../lib/src/validator.dart'; | 14 import '../../lib/src/validator.dart'; |
| 15 import '../../lib/src/validator/dependency.dart'; | 15 import '../../lib/src/validator/dependency.dart'; |
| 16 import '../descriptor.dart' as d; | 16 import '../descriptor.dart' as d; |
| 17 import '../test_pub.dart'; | 17 import '../test_pub.dart'; |
| 18 import 'utils.dart'; | 18 import 'utils.dart'; |
| 19 | 19 |
| 20 Validator dependency(Entrypoint entrypoint) => | 20 Validator dependency(Entrypoint entrypoint) => |
| 21 new DependencyValidator(entrypoint); | 21 new DependencyValidator(entrypoint); |
| 22 | 22 |
| 23 expectDependencyValidationError(String error) { | 23 expectDependencyValidationError(String error) { |
| 24 expect(schedulePackageValidation(dependency), | 24 expect(schedulePackageValidation(dependency), |
| 25 completion(pairOf(someElement(contains(error)), isEmpty))); | 25 completion(pairOf(anyElement(contains(error)), isEmpty))); |
| 26 } | 26 } |
| 27 | 27 |
| 28 expectDependencyValidationWarning(String warning) { | 28 expectDependencyValidationWarning(String warning) { |
| 29 expect(schedulePackageValidation(dependency), | 29 expect(schedulePackageValidation(dependency), |
| 30 completion(pairOf(isEmpty, someElement(contains(warning))))); | 30 completion(pairOf(isEmpty, anyElement(contains(warning))))); |
| 31 } | 31 } |
| 32 | 32 |
| 33 /// Sets up a test package with dependency [dep] and mocks a server with | 33 /// Sets up a test package with dependency [dep] and mocks a server with |
| 34 /// [hostedVersions] of the package available. | 34 /// [hostedVersions] of the package available. |
| 35 setUpDependency(Map dep, {List<String> hostedVersions}) { | 35 setUpDependency(Map dep, {List<String> hostedVersions}) { |
| 36 useMockClient(new MockClient((request) { | 36 useMockClient(new MockClient((request) { |
| 37 expect(request.method, equals("GET")); | 37 expect(request.method, equals("GET")); |
| 38 expect(request.url.path, equals("/api/packages/foo")); | 38 expect(request.url.path, equals("/api/packages/foo")); |
| 39 | 39 |
| 40 if (hostedVersions == null) { | 40 if (hostedVersions == null) { |
| (...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 242 d.dir(appPath, [ | 242 d.dir(appPath, [ |
| 243 d.libPubspec("test_pkg", "1.0.0", deps: { | 243 d.libPubspec("test_pkg", "1.0.0", deps: { |
| 244 "test_pkg": ">=1.0.0" | 244 "test_pkg": ">=1.0.0" |
| 245 }) | 245 }) |
| 246 ]).create(); | 246 ]).create(); |
| 247 | 247 |
| 248 expectValidationWarning(dependency); | 248 expectValidationWarning(dependency); |
| 249 }); | 249 }); |
| 250 }); | 250 }); |
| 251 } | 251 } |
| OLD | NEW |