@@ -17,8 +17,9 @@ ValidatorCreator size(int size) {
17
17
return (entrypoint) => new SizeValidator (entrypoint, new Future .value (size));
18
18
}
19
19
20
- expectSizeValidationError (ValidatorCreator fn, Matcher matcher) {
21
- expect (validatePackage (fn), completion (pairOf (contains (matcher), anything)));
20
+ expectSizeValidationError (Matcher matcher) {
21
+ expect (validatePackage (size (100 * math.pow (2 , 20 ) + 1 )),
22
+ completion (pairOf (contains (matcher), anything)));
22
23
}
23
24
24
25
main () {
@@ -35,7 +36,6 @@ main() {
35
36
await d.validPackage.create ();
36
37
37
38
expectSizeValidationError (
38
- size (100 * math.pow (2 , 20 ) + 1 ),
39
39
equals ("Your package is 100.0 MB. Hosted packages must "
40
40
"be smaller than 100 MB." ));
41
41
});
@@ -44,32 +44,27 @@ main() {
44
44
await d.validPackage.create ();
45
45
await d.dir (appPath, [d.file ('.gitignore' , 'ignored' )]).create ();
46
46
47
- expectSizeValidationError (
48
- size (100 * math.pow (2 , 20 ) + 1 ),
49
- allOf (
50
- contains ("Hosted packages must be smaller than 100 MB." ),
51
- contains ("Your .gitignore has no effect since your project "
52
- "does not appear to be in version control." )));
47
+ expectSizeValidationError (allOf (
48
+ contains ("Hosted packages must be smaller than 100 MB." ),
49
+ contains ("Your .gitignore has no effect since your project "
50
+ "does not appear to be in version control." )));
53
51
});
54
52
55
53
test ('package is under source control and no .gitignore exists' , () async {
56
54
await d.validPackage.create ();
57
55
await d.git (appPath).create ();
58
56
59
- expectSizeValidationError (
60
- size (100 * math.pow (2 , 20 ) + 1 ),
61
- allOf (
62
- contains ("Hosted packages must be smaller than 100 MB." ),
63
- contains ("Consider adding a .gitignore to avoid including "
64
- "temporary files." )));
57
+ expectSizeValidationError (allOf (
58
+ contains ("Hosted packages must be smaller than 100 MB." ),
59
+ contains ("Consider adding a .gitignore to avoid including "
60
+ "temporary files." )));
65
61
});
66
62
67
63
test ('package is under source control and .gitignore exists' , () async {
68
64
await d.validPackage.create ();
69
65
await d.git (appPath, [d.file ('.gitignore' , 'ignored' )]).create ();
70
66
71
67
expectSizeValidationError (
72
- size (100 * math.pow (2 , 20 ) + 1 ),
73
68
equals ("Your package is 100.0 MB. Hosted packages must "
74
69
"be smaller than 100 MB." ));
75
70
});
0 commit comments