@@ -27,17 +27,24 @@ final expectedUsage = [
2727Generate a Very Good Flutter application.
2828
2929Usage: very_good create flutter_app <project-name> [arguments]
30- -h, --help Print this usage information.
31- -o, --output-directory The desired output directory when creating a new project.
32- --description The description for this new project.
33- (defaults to "A Very Good Project created by Very Good CLI.")
34- -t, --template The template used to generate this new project.
30+ -h, --help Print this usage information.
31+ -o, --output-directory The desired output directory when creating a new project.
32+ --description The description for this new project.
33+ (defaults to "A Very Good Project created by Very Good CLI.")
34+ -t, --template The template used to generate this new project.
3535
36- [core] (default) Generate a Very Good Flutter application.
36+ [core] (default) Generate a Very Good Flutter application.
3737
38- --org-name The organization for this new project.
39- (defaults to "com.example.verygoodcore")
40- --application-id The bundle identifier on iOS or application id on Android. (defaults to <org-name>.<project-name>)
38+ --org-name The organization for this new project.
39+ (defaults to "com.example.verygoodcore")
40+ --application-id The bundle identifier on iOS or application id on Android. (defaults to <org-name>.<project-name>)
41+ --platforms The platforms supported by the app. By default, all platforms are enabled. Example: --platforms=android,ios
42+
43+ [android] (default) The app supports the Android platform.
44+ [ios] (default) The app supports the iOS platform.
45+ [macos] (default) The app supports the macOS platform.
46+ [web] (default) The app supports the Web platform.
47+ [windows] (default) The app supports the Windows platform.
4148
4249Run "very_good help" to see global options.''' ,
4350];
@@ -169,12 +176,54 @@ void main() {
169176 hooks: hooks,
170177 generator: generator,
171178 templateName: 'core' ,
172- mockArgs: {'application-id' : 'xyz.app.my_app' },
179+ mockArgs: {
180+ 'application-id' : 'xyz.app.my_app' ,
181+ 'platforms' : const [
182+ 'android' ,
183+ 'ios' ,
184+ 'macos' ,
185+ 'web' ,
186+ 'windows' ,
187+ ],
188+ },
189+ expectedVars: {
190+ 'project_name' : 'my_app' ,
191+ 'description' : '' ,
192+ 'org_name' : 'com.example.verygoodcore' ,
193+ 'application_id' : 'xyz.app.my_app' ,
194+ 'platforms' : const [
195+ 'android' ,
196+ 'ios' ,
197+ 'macos' ,
198+ 'web' ,
199+ 'windows' ,
200+ ],
201+ },
202+ expectedLogSummary: 'Created a Very Good App! 🦄' ,
203+ );
204+ });
205+
206+ test ('generates successfully with custom platforms' , () async {
207+ await testMultiTemplateCommand (
208+ multiTemplatesCommand: CreateFlutterApp (
209+ logger: logger,
210+ generatorFromBundle: (_) async => throw Exception ('oops' ),
211+ generatorFromBrick: (_) async => generator,
212+ ),
213+ logger: logger,
214+ hooks: hooks,
215+ generator: generator,
216+ templateName: 'core' ,
217+ mockArgs: {
218+ 'application-id' : 'xyz.app.my_app' ,
219+ 'platforms' : const ['android' , 'ios' ],
220+ },
173221 expectedVars: {
174222 'project_name' : 'my_app' ,
175223 'description' : '' ,
176224 'org_name' : 'com.example.verygoodcore' ,
177225 'application_id' : 'xyz.app.my_app' ,
226+ 'platforms' : const ['android' , 'ios' ],
178227 },
179228 expectedLogSummary: 'Created a Very Good App! 🦄' ,
180229 );
@@ -195,12 +244,28 @@ void main() {
195244 hooks: hooks,
196245 generator: generator,
197246 templateName: 'core' ,
198- mockArgs: {'application-id' : 'xyz.app.my_app' },
247+ mockArgs: {
248+ 'application-id' : 'xyz.app.my_app' ,
249+ 'platforms' : const [
250+ 'android' ,
251+ 'ios' ,
252+ 'macos' ,
253+ 'web' ,
254+ 'windows' ,
255+ ],
256+ },
199257 expectedVars: {
200258 'project_name' : 'my_app' ,
201259 'description' : '' ,
202260 'org_name' : 'com.example.verygoodcore' ,
203261 'application_id' : 'xyz.app.my_app' ,
262+ 'platforms' : const [
263+ 'android' ,
264+ 'ios' ,
265+ 'macos' ,
266+ 'web' ,
267+ 'windows' ,
268+ ],
204269 },
205270 expectedLogSummary: 'Created a Very Good App! 🦄' ,
206271 );
0 commit comments