11import 'package:ht_shared/ht_shared.dart' ;
2+ import 'package:json_annotation/json_annotation.dart' ;
23import 'package:test/test.dart' ;
34
45void main () {
@@ -41,14 +42,14 @@ void main() {
4142 final jsonMissingUser = {'token' : testToken};
4243 expect (
4344 () => AuthSuccessResponse .fromJson (jsonMissingUser),
44- throwsA (isA <TypeError >()), // Or specific JsonKeyRequiredError
45+ throwsA (isA <CheckedFromJsonException >()),
4546 );
4647
4748 // Missing 'token'
4849 final jsonMissingToken = {'user' : testUser.toJson ()};
4950 expect (
5051 () => AuthSuccessResponse .fromJson (jsonMissingToken),
51- throwsA (isA <TypeError >()), // Or specific JsonKeyRequiredError
52+ throwsA (isA <CheckedFromJsonException >()),
5253 );
5354 });
5455
@@ -60,7 +61,7 @@ void main() {
6061 };
6162 expect (
6263 () => AuthSuccessResponse .fromJson (jsonWrongUserType),
63- throwsA (isA <TypeError >()),
64+ throwsA (isA <CheckedFromJsonException >()),
6465 );
6566
6667 // Incorrect type for 'token'
@@ -70,7 +71,7 @@ void main() {
7071 };
7172 expect (
7273 () => AuthSuccessResponse .fromJson (jsonWrongTokenType),
73- throwsA (isA <TypeError >()),
74+ throwsA (isA <CheckedFromJsonException >()),
7475 );
7576 });
7677 });
0 commit comments