I want to write a test for a user_data dart file. I want to check if data has been successfully written into the json file through an effective test.
@JsonSerializable()
class UserData {
UserData({
this.id,
this.createdAt,
this.defaultLanguage,
this.defaultSchool,
});
factory UserData.fromJson(Map<String, dynamic> json) =>
_$UserDataFromJson(json);
final String? id;
final DateTime? createdAt;
final String? defaultLanguage;
final School? defaultSchool;
}
Can anyone help to generate a unit test for the above dart code? Thank you!
I'm not entirely sure what you mean but I think you want to make sure that your deserialization works, right?