22import 'dart:io' ;
33
44import 'package:flutter_gen/src/flutter_generator.dart' ;
5- import 'package:flutter_gen/src/settings/config.dart' ;
6- import 'package:flutter_gen/src/utils/error.dart' ;
75import 'package:test/test.dart' ;
86
97void main () {
@@ -16,23 +14,53 @@ void main() {
1614 });
1715 group ('Test FlutterGenerator Exceptions' , () {
1816 test ('Not founded pubspec.yaml' , () async {
19- expect (() async {
20- return await Config (File ('test_resources/pubspec_not_founded.yaml' ))
21- .load ();
22- }, throwsA (isA <FileSystemException >()));
17+ await FlutterGenerator (File ('test_resources/pubspec_not_founded.yaml' ))
18+ .build ();
19+ expect (
20+ File ('test_resources/lib/gen/assets.gen.dart' ).existsSync (),
21+ isFalse,
22+ );
23+ expect (
24+ File ('test_resources/lib/gen/fonts.gen.dart' ).existsSync (),
25+ isFalse,
26+ );
27+ expect (
28+ File ('test_resources/lib/gen/colors.gen.dart' ).existsSync (),
29+ isFalse,
30+ );
2331 });
2432
2533 test ('Empty pubspec.yaml' , () async {
26- expect (() async {
27- return await Config (File ('test_resources/pubspec_empty.yaml' )).load ();
28- }, throwsA (isA <InvalidSettingsException >()));
34+ await FlutterGenerator (File ('test_resources/pubspec_empty.yaml' )).build ();
35+ expect (
36+ File ('test_resources/lib/gen/assets.gen.dart' ).existsSync (),
37+ isFalse,
38+ );
39+ expect (
40+ File ('test_resources/lib/gen/fonts.gen.dart' ).existsSync (),
41+ isFalse,
42+ );
43+ expect (
44+ File ('test_resources/lib/gen/colors.gen.dart' ).existsSync (),
45+ isFalse,
46+ );
2947 });
3048
3149 test ('No settings pubspec.yaml' , () async {
32- expect (() async {
33- return await Config (File ('test_resources/pubspec_no_settings.yaml' ))
34- .load ();
35- }, throwsA (isA <InvalidSettingsException >()));
50+ await FlutterGenerator (File ('test_resources/pubspec_no_settings.yaml' ))
51+ .build ();
52+ expect (
53+ File ('test_resources/lib/gen/assets.gen.dart' ).existsSync (),
54+ isFalse,
55+ );
56+ expect (
57+ File ('test_resources/lib/gen/fonts.gen.dart' ).existsSync (),
58+ isFalse,
59+ );
60+ expect (
61+ File ('test_resources/lib/gen/colors.gen.dart' ).existsSync (),
62+ isFalse,
63+ );
3664 });
3765 });
3866
@@ -124,5 +152,29 @@ void main() {
124152 isNotEmpty,
125153 );
126154 });
155+
156+ // test('Assets with No lists on pubspec.yaml', () async {
157+ // expect(() async {
158+ // return FlutterGenerator(
159+ // File('test_resources/pubspec_assets_no_list.yaml'))
160+ // .build();
161+ // }, throwsA(isA<InvalidSettingsException>()));
162+ // });
163+ //
164+ // test('Wrong fonts settings on pubspec.yaml', () async {
165+ // expect(() async {
166+ // return FlutterGenerator(
167+ // File('test_resources/pubspec_fonts_no_family.yaml'))
168+ // .build();
169+ // }, throwsA(isA<InvalidSettingsException>()));
170+ // });
171+ //
172+ // test('Wrong colors settings on pubspec.yaml', () async {
173+ // expect(() async {
174+ // return FlutterGenerator(
175+ // File('test_resources/pubspec_colors_no_inputs.yaml'))
176+ // .build();
177+ // }, throwsA(isA<InvalidSettingsException>()));
178+ // });
127179 });
128180}
0 commit comments