From 4cea6755058951ea9fc84dfbfa2c93f7f579d74f Mon Sep 17 00:00:00 2001 From: Yelaman Yelmuratov Date: Sun, 30 Jun 2024 11:15:35 +0500 Subject: [PATCH] . r toJson methods to tests --- packages/approval_tests/test/models/item.dart | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/packages/approval_tests/test/models/item.dart b/packages/approval_tests/test/models/item.dart index 3587eea..fc3f4ad 100644 --- a/packages/approval_tests/test/models/item.dart +++ b/packages/approval_tests/test/models/item.dart @@ -11,6 +11,13 @@ class JsonItem { required this.subItem, required this.anotherItem, }); + + Map toJson() => { + 'id': id, + 'name': name, + 'subItem': subItem.toJson(), + 'anotherItem': anotherItem.toJson(), + }; } /// Sub item class for testing @@ -24,6 +31,12 @@ class SubItem { required this.name, required this.anotherItems, }); + + Map toJson() => { + 'id': id, + 'name': name, + 'anotherItems': anotherItems.map((e) => e.toJson()).toList(), + }; } /// Another item class for testing @@ -32,4 +45,9 @@ class AnotherItem { final String name; const AnotherItem({required this.id, required this.name}); + + Map toJson() => { + 'id': id, + 'name': name, + }; }