@@ -91,8 +91,7 @@ TestModel:
91
91
expect (error, isNotNull);
92
92
expect (error, isArgumentError);
93
93
if (error is ArgumentError ) {
94
- expect (error.message,
95
- 'required is removed, follow the migration to version 7.0.0' );
94
+ expect (error.message, 'required is removed, follow the migration to version 7.0.0' );
96
95
}
97
96
});
98
97
@@ -118,8 +117,7 @@ TestModel:
118
117
expect (error, isNotNull);
119
118
expect (error, isException);
120
119
if (error is Exception ) {
121
- expect (error.toString (),
122
- 'Exception: Could not generate all models. `array` is not added to the config file' );
120
+ expect (error.toString (), 'Exception: Could not generate all models. `array` is not added to the config file' );
123
121
}
124
122
});
125
123
@@ -146,8 +144,7 @@ TestModel:
146
144
expect (error, isNotNull);
147
145
expect (error, isException);
148
146
if (error is Exception ) {
149
- expect (error.toString (),
150
- 'Exception: Could not generate all models. `map` is not added to the config file' );
147
+ expect (error.toString (), 'Exception: Could not generate all models. `map` is not added to the config file' );
151
148
}
152
149
});
153
150
@@ -216,6 +213,34 @@ TestModel2:
216
213
expect (nullableRef.type, isA <ObjectType >());
217
214
expect (nullableRef.isRequired, false );
218
215
});
216
+
217
+ test ('Test enum item_type should be string or integer' , () {
218
+ dynamic error;
219
+ try {
220
+ YmlGeneratorConfig (
221
+ PubspecConfig ("name: test" ),
222
+ """
223
+ Gender:
224
+ path: user/person/
225
+ type: enum
226
+ item_type: List
227
+ properties:
228
+ MALE:
229
+ value: male
230
+ FEMALE:
231
+ value: female
232
+ """ ,
233
+ '' )
234
+ .models;
235
+ } catch (e) {
236
+ error = e;
237
+ }
238
+ expect (error, isNotNull);
239
+ expect (error, isException);
240
+ if (error is Exception ){
241
+ expect (error.toString (), 'Exception: item_type should be a string or integer. model: Gender' );
242
+ }
243
+ });
219
244
});
220
245
}
221
246
0 commit comments