33// found in the LICENSE file.
44
55import 'package:file/file.dart' ;
6- import 'package:flutter_plugin_tools/src/common/ci_config.dart' ;
7- import 'package:flutter_plugin_tools/src/common/repository_package.dart' ;
86import 'package:test/test.dart' ;
97
108import '../util.dart' ;
@@ -19,18 +17,24 @@ void main() {
1917
2018 group ('CIConfig' , () {
2119 test ('file' , () async {
22- final RepositoryPackage plugin =
23- createFakePlugin ('a_plugin' , packagesDir);
20+ final RepositoryPackage plugin = createFakePlugin (
21+ 'a_plugin' ,
22+ packagesDir,
23+ );
2424
2525 final File ciConfigFile = plugin.ciConfigFile;
2626
2727 expect (
28- ciConfigFile.path, plugin.directory.childFile ('ci_config.yaml' ).path);
28+ ciConfigFile.path,
29+ plugin.directory.childFile ('ci_config.yaml' ).path,
30+ );
2931 });
3032
3133 test ('parsing' , () async {
32- final RepositoryPackage plugin =
33- createFakePlugin ('a_plugin' , packagesDir);
34+ final RepositoryPackage plugin = createFakePlugin (
35+ 'a_plugin' ,
36+ packagesDir,
37+ );
3438 plugin.ciConfigFile.writeAsStringSync ('''
3539release:
3640 batch: true
@@ -43,56 +47,76 @@ release:
4347 });
4448
4549 test ('parsing missing file returns null' , () async {
46- final RepositoryPackage plugin =
47- createFakePlugin ('a_plugin' , packagesDir);
50+ final RepositoryPackage plugin = createFakePlugin (
51+ 'a_plugin' ,
52+ packagesDir,
53+ );
4854
4955 final CIConfig ? config = plugin.parseCIConfig ();
5056
5157 expect (config, isNull);
5258 });
5359
5460 test ('parsing invalid file throws' , () async {
55- final RepositoryPackage plugin =
56- createFakePlugin ('a_plugin' , packagesDir);
61+ final RepositoryPackage plugin = createFakePlugin (
62+ 'a_plugin' ,
63+ packagesDir,
64+ );
5765 plugin.ciConfigFile.writeAsStringSync ('not a map' );
5866
5967 expect (
60- () => plugin.parseCIConfig (),
61- throwsA (isA <FormatException >().having (
62- (FormatException e) => e.message,
63- 'message' ,
64- contains ('Root of ci_config.yaml must be a map' ))));
68+ () => plugin.parseCIConfig (),
69+ throwsA (
70+ isA <FormatException >().having (
71+ (FormatException e) => e.message,
72+ 'message' ,
73+ contains ('Root of ci_config.yaml must be a map' ),
74+ ),
75+ ),
76+ );
6577 });
6678
6779 test ('reports unknown keys' , () {
68- final RepositoryPackage plugin =
69- createFakePlugin ('a_plugin' , packagesDir);
80+ final RepositoryPackage plugin = createFakePlugin (
81+ 'a_plugin' ,
82+ packagesDir,
83+ );
7084 plugin.ciConfigFile.writeAsStringSync ('''
7185foo: bar
7286''' );
7387
7488 expect (
75- () => plugin.parseCIConfig (),
76- throwsA (isA <FormatException >().having (
77- (FormatException e) => e.message,
78- 'message' ,
79- contains ('Unknown key `foo` in config' ))));
89+ () => plugin.parseCIConfig (),
90+ throwsA (
91+ isA <FormatException >().having (
92+ (FormatException e) => e.message,
93+ 'message' ,
94+ contains ('Unknown key `foo` in config' ),
95+ ),
96+ ),
97+ );
8098 });
8199
82100 test ('reports invalid values' , () {
83- final RepositoryPackage plugin =
84- createFakePlugin ('a_plugin' , packagesDir);
101+ final RepositoryPackage plugin = createFakePlugin (
102+ 'a_plugin' ,
103+ packagesDir,
104+ );
85105 plugin.ciConfigFile.writeAsStringSync ('''
86106release:
87107 batch: not-a-bool
88108''' );
89109
90110 expect (
91- () => plugin.parseCIConfig (),
92- throwsA (isA <FormatException >().having (
93- (FormatException e) => e.message,
94- 'message' ,
95- contains ('Invalid value `not-a-bool` for key `release.batch`' ))));
111+ () => plugin.parseCIConfig (),
112+ throwsA (
113+ isA <FormatException >().having (
114+ (FormatException e) => e.message,
115+ 'message' ,
116+ contains ('Invalid value `not-a-bool` for key `release.batch`' ),
117+ ),
118+ ),
119+ );
96120 });
97121 });
98122}
0 commit comments