Skip to content

Commit

Permalink
#130: fixed remaining tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jorre127 committed Sep 8, 2023
1 parent 8b76a64 commit c224aa3
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion test/config/yml_generator_config/enum-normal.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Gender:

Vehicles:
type: enum
uppercase_enums: false
uppercase_enums: true
properties:
value:
type: String
Expand Down
18 changes: 9 additions & 9 deletions test/config/yml_generator_config_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -173,43 +173,43 @@ void main() {
expect(ymlConfig.models.first is ObjectModel, true);
expect(ymlConfig.models[1] is EnumModel, true);
expect(ymlConfig.models.last is EnumModel, true);
expect(pubspecConfig.uppercaseEnums, true);
expect(pubspecConfig.uppercaseEnums, false);
final enumModel = ymlConfig.models[1] as EnumModel; // ignore: avoid_as
final enumModel2 = ymlConfig.models[2] as EnumModel; // ignore: avoid_as
expect(enumModel.fields, isNotNull);
expect(enumModel.fields.length, 4);
expect(enumModel.fields[0].name, 'MALE');
expect(enumModel.fields[0].name, 'male');
expect(enumModel.fields[0].serializedName, 'MALE');
expect(enumModel.fields[0].values[0].value, 'male');
expect(enumModel.fields[0].values[0].propertyName, 'value');
expect(enumModel.fields[1].name, 'FEMALE');
expect(enumModel.fields[1].name, 'female');
expect(enumModel.fields[1].serializedName, 'FEMALE');
expect(enumModel.fields[1].values[0].value, 'femAle');
expect(enumModel.fields[1].values[0].propertyName, 'value');
expect(enumModel.fields[2].name, 'OTHER');
expect(enumModel.fields[2].name, 'other');
expect(enumModel.fields[2].serializedName, 'other');
expect(enumModel.fields[2].values[0].value, 'other');
expect(enumModel.fields[2].values[0].propertyName, 'value');
expect(enumModel.fields[3].name, 'X');
expect(enumModel.fields[3].name, 'x');
expect(enumModel.fields[3].serializedName, 'X');
expect(enumModel.fields[3].values[0].value, 'x');
expect(enumModel.fields[3].values[0].propertyName, 'value');

expect(enumModel2.fields, isNotNull);
expect(enumModel2.fields.length, 4);
expect(enumModel2.fields[0].name, 'male');
expect(enumModel2.fields[0].name, 'MALE');
expect(enumModel2.fields[0].serializedName, 'male');
expect(enumModel.fields[0].values[0].value, 'male');
expect(enumModel.fields[0].values[0].propertyName, 'value');
expect(enumModel2.fields[1].name, 'female');
expect(enumModel2.fields[1].name, 'FEMALE');
expect(enumModel2.fields[1].serializedName, 'female');
expect(enumModel.fields[1].values[0].value, 'femAle');
expect(enumModel.fields[1].values[0].propertyName, 'value');
expect(enumModel2.fields[2].name, 'other');
expect(enumModel2.fields[2].name, 'OTHER');
expect(enumModel2.fields[2].serializedName, 'other');
expect(enumModel.fields[2].values[0].value, 'other');
expect(enumModel.fields[2].values[0].propertyName, 'value');
expect(enumModel2.fields[3].name, 'x');
expect(enumModel2.fields[3].name, 'X');
expect(enumModel2.fields[3].serializedName, 'x');
expect(enumModel.fields[3].values[0].value, 'x');
expect(enumModel.fields[3].values[0].propertyName, 'value');
Expand Down
8 changes: 4 additions & 4 deletions test/writer/enum_model_reader_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ Gender:
}) {
testEnumError(
expectedError:
'Exception: There is no value defined for property name for the enum value FEMALE in model Gender. Either make this property optional or give it a value',
'Exception: There is no value defined for property name for the enum value female in model Gender. Either make this property optional or give it a value',
enumYml: """
Gender:
path: user/person/
Expand Down Expand Up @@ -200,7 +200,7 @@ Gender:
'Test enum with incorrect type bool',
() => testEnumError(
expectedError:
'Exception: Model: Gender, Property isMale is of type bool but the corresponding value on enum value MALE is not, make sure they have the same type',
'Exception: Model: Gender, Property isMale is of type bool but the corresponding value on enum value male is not, make sure they have the same type',
enumYml: """
Gender:
path: user/person/
Expand All @@ -224,7 +224,7 @@ Gender:
'Test enum with incorrect type integer',
() => testEnumError(
expectedError:
'Exception: Model: Gender, Property isMale is of type int but the corresponding value on enum value MALE is not, make sure they have the same type',
'Exception: Model: Gender, Property isMale is of type int but the corresponding value on enum value male is not, make sure they have the same type',
enumYml: """
Gender:
path: user/person/
Expand All @@ -248,7 +248,7 @@ Gender:
'Test enum with incorrect type double',
() => testEnumError(
expectedError:
'Exception: Model: Gender, Property isMale is of type double but the corresponding value on enum value MALE is not, make sure they have the same type',
'Exception: Model: Gender, Property isMale is of type double but the corresponding value on enum value male is not, make sure they have the same type',
enumYml: """
Gender:
path: user/person/
Expand Down

0 comments on commit c224aa3

Please sign in to comment.