diff --git a/packages/test-base/src/commonTest/kotlin/io/realm/kotlin/test/common/PersistedNameTests.kt b/packages/test-base/src/commonTest/kotlin/io/realm/kotlin/test/common/PersistedNameTests.kt index d7284159d1..07dd7069e1 100644 --- a/packages/test-base/src/commonTest/kotlin/io/realm/kotlin/test/common/PersistedNameTests.kt +++ b/packages/test-base/src/commonTest/kotlin/io/realm/kotlin/test/common/PersistedNameTests.kt @@ -387,7 +387,14 @@ class PersistedNameTests { copyToRealm( Parent().apply { this.child = Child().apply { name = "child1" } - this.children.add(Child().apply { children.add(Child()) }) + this.children.add( + Child().apply { + name = "first-child" + children.add( + Child().apply { name = "first-grand-child" } + ) + } + ) } ) } @@ -395,8 +402,11 @@ class PersistedNameTests { assertEquals(1, realm.query().count().find()) assertEquals(3, realm.query().count().find()) - assertEquals("child1", realm.query().first().find()!!.child!!.name) - + val parent = realm.query().first().find()!! + assertEquals("child1", parent.child!!.name) + val child2 = parent.children.first() + assertEquals("first-child", child2.name) + assertEquals("first-grand-child", child2.children.first().name) } }