OLD | NEW |
| (Empty) |
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 | |
3 // BSD-style license that can be found in the LICENSE file. | |
4 | |
5 import 'package:scheduled_test/scheduled_test.dart'; | |
6 | |
7 import '../../../pub/entrypoint.dart'; | |
8 import '../../../pub/validator.dart'; | |
9 import '../../../pub/validator/pubspec_field.dart'; | |
10 import '../descriptor.dart' as d; | |
11 import '../test_pub.dart'; | |
12 import 'utils.dart'; | |
13 | |
14 Validator pubspecField(Entrypoint entrypoint) => | |
15 new PubspecFieldValidator(entrypoint); | |
16 | |
17 main() { | |
18 initConfig(); | |
19 | |
20 group('should consider a package valid if it', () { | |
21 setUp(d.validPackage.create); | |
22 | |
23 integration('looks normal', () => expectNoValidationError(pubspecField)); | |
24 | |
25 integration('has "authors" instead of "author"', () { | |
26 var pkg = packageMap("test_pkg", "1.0.0"); | |
27 pkg["authors"] = [pkg.remove("author")]; | |
28 d.dir(appPath, [d.pubspec(pkg)]).create(); | |
29 expectNoValidationError(pubspecField); | |
30 }); | |
31 }); | |
32 | |
33 group('should consider a package invalid if it', () { | |
34 setUp(d.validPackage.create); | |
35 | |
36 integration('is missing the "homepage" field', () { | |
37 var pkg = packageMap("test_pkg", "1.0.0"); | |
38 pkg.remove("homepage"); | |
39 d.dir(appPath, [d.pubspec(pkg)]).create(); | |
40 | |
41 expectValidationError(pubspecField); | |
42 }); | |
43 | |
44 integration('is missing the "description" field', () { | |
45 var pkg = packageMap("test_pkg", "1.0.0"); | |
46 pkg.remove("description"); | |
47 d.dir(appPath, [d.pubspec(pkg)]).create(); | |
48 | |
49 expectValidationError(pubspecField); | |
50 }); | |
51 | |
52 integration('is missing the "author" field', () { | |
53 var pkg = packageMap("test_pkg", "1.0.0"); | |
54 pkg.remove("author"); | |
55 d.dir(appPath, [d.pubspec(pkg)]).create(); | |
56 | |
57 expectValidationError(pubspecField); | |
58 }); | |
59 | |
60 integration('has a single author without an email', () { | |
61 var pkg = packageMap("test_pkg", "1.0.0"); | |
62 pkg["author"] = "Nathan Weizenbaum"; | |
63 d.dir(appPath, [d.pubspec(pkg)]).create(); | |
64 | |
65 expectValidationWarning(pubspecField); | |
66 }); | |
67 | |
68 integration('has one of several authors without an email', () { | |
69 var pkg = packageMap("test_pkg", "1.0.0"); | |
70 pkg.remove("author"); | |
71 pkg["authors"] = [ | |
72 "Bob Nystrom <rnystrom@google.com>", | |
73 "Nathan Weizenbaum", | |
74 "John Messerly <jmesserly@google.com>" | |
75 ]; | |
76 d.dir(appPath, [d.pubspec(pkg)]).create(); | |
77 | |
78 expectValidationWarning(pubspecField); | |
79 }); | |
80 | |
81 integration('has a single author without a name', () { | |
82 var pkg = packageMap("test_pkg", "1.0.0"); | |
83 pkg["author"] = "<nweiz@google.com>"; | |
84 d.dir(appPath, [d.pubspec(pkg)]).create(); | |
85 | |
86 expectValidationWarning(pubspecField); | |
87 }); | |
88 | |
89 integration('has one of several authors without a name', () { | |
90 var pkg = packageMap("test_pkg", "1.0.0"); | |
91 pkg.remove("author"); | |
92 pkg["authors"] = [ | |
93 "Bob Nystrom <rnystrom@google.com>", | |
94 "<nweiz@google.com>", | |
95 "John Messerly <jmesserly@google.com>" | |
96 ]; | |
97 d.dir(appPath, [d.pubspec(pkg)]).create(); | |
98 | |
99 expectValidationWarning(pubspecField); | |
100 }); | |
101 }); | |
102 } | |
OLD | NEW |