refactor(NodeItem): replace NodeInfo with NodeEntity

This commit is contained in:
andrekir
2024-09-21 15:45:10 -03:00
committed by Andre K
parent 89a3171b58
commit 83dc389d6d
12 changed files with 373 additions and 160 deletions

View File

@@ -140,7 +140,9 @@ class NodeInfoDaoTest {
@Test
fun testSortByDistance() = runBlocking {
val nodes = getNodes(sort = NodeSortOption.DISTANCE)
val sortedNodes = nodes.sortedBy { it.distance(ourNode) }
val sortedNodes = nodes.sortedWith( // nodes with invalid (null) positions at the end
compareBy<NodeEntity> { it.validPosition == null }.thenBy { it.distance(ourNode) }
)
assertEquals(sortedNodes, nodes)
}