Skip to content

Commit

Permalink
Update json_serialization_and_deserialization_test.dart
Browse files Browse the repository at this point in the history
  • Loading branch information
marcglasberg committed Mar 26, 2024
1 parent 4cc9ef8 commit 49c292e
Showing 1 changed file with 13 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,19 @@ void main() {

test('can deserialize IList of enums', () {
expect(IListWrapper2.fromJson({'iList': <TestEnum>[]}).iList, IList(<TestEnum>[]));
expect(
IListWrapper2.fromJson({
'iList': <TestEnum>[TestEnum.valA, TestEnum.valB, TestEnum.valC]
}).iList,
IList(<TestEnum>[TestEnum.valA, TestEnum.valB, TestEnum.valC]));

IList result;
try {
result = IListWrapper2.fromJson({
'iList': <String>['valA', 'valB', 'valC']
}).iList;
} catch (e) {
result = IListWrapper2.fromJson({
'iList': <TestEnum>[TestEnum.valA, TestEnum.valB, TestEnum.valC]
}).iList;
}

expect(result, IList(<TestEnum>[TestEnum.valA, TestEnum.valB, TestEnum.valC]));
});
});

Expand Down

0 comments on commit 49c292e

Please sign in to comment.