Skip to content

Commit

Permalink
item can reconstitute children items
Browse files Browse the repository at this point in the history
  • Loading branch information
vextorspace committed Jun 28, 2024
1 parent 4eb4f81 commit f47787c
Showing 1 changed file with 30 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

}

0 comments on commit f47787c

Please sign in to comment.