@@ -17,8 +17,9 @@ ValidatorCreator size(int size) {
1717 return (entrypoint) => new SizeValidator (entrypoint, new Future .value (size));
1818}
1919
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)));
2223}
2324
2425main () {
@@ -35,7 +36,6 @@ main() {
3536 await d.validPackage.create ();
3637
3738 expectSizeValidationError (
38- size (100 * math.pow (2 , 20 ) + 1 ),
3939 equals ("Your package is 100.0 MB. Hosted packages must "
4040 "be smaller than 100 MB." ));
4141 });
@@ -44,32 +44,27 @@ main() {
4444 await d.validPackage.create ();
4545 await d.dir (appPath, [d.file ('.gitignore' , 'ignored' )]).create ();
4646
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." )));
5351 });
5452
5553 test ('package is under source control and no .gitignore exists' , () async {
5654 await d.validPackage.create ();
5755 await d.git (appPath).create ();
5856
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." )));
6561 });
6662
6763 test ('package is under source control and .gitignore exists' , () async {
6864 await d.validPackage.create ();
6965 await d.git (appPath, [d.file ('.gitignore' , 'ignored' )]).create ();
7066
7167 expectSizeValidationError (
72- size (100 * math.pow (2 , 20 ) + 1 ),
7368 equals ("Your package is 100.0 MB. Hosted packages must "
7469 "be smaller than 100 MB." ));
7570 });
0 commit comments