diff --git a/composeApp/src/commonTest/kotlin/model/ItemReconstitutesFromJsonTest.kt b/composeApp/src/commonTest/kotlin/model/ItemReconstitutesFromJsonTest.kt index 67d28b5..f0436fb 100644 --- a/composeApp/src/commonTest/kotlin/model/ItemReconstitutesFromJsonTest.kt +++ b/composeApp/src/commonTest/kotlin/model/ItemReconstitutesFromJsonTest.kt @@ -40,4 +40,34 @@ class ItemReconstitutesFromJsonTest { item!!.subItems.shouldBeEmpty() } + @Test + fun `Item with subItems reconstitutes`() { + // Given + val id = "::SOME_UUID::" + val content = "::ITEM CONTENT::" + val subItemContent = "::SUB ITEM CONTENT::" + val subId = "::SUB_UUID::" + + val subItemJson = """ + { + "content": "$subItemContent", + "id": "$subId", + "subItems": [] + } + """ + val itemJson = """ + { + "content": "$content", + "id": "$id", + "subItems": [$subItemJson] + } + """ + + // When + val item = Item.fromJson(itemJson) + + // Then + item shouldBe Item(content, mutableListOf(Item(subItemContent, mutableListOf(), subId)), id) + } + } \ No newline at end of file