Skip to content

Commit c3b2b21

Browse files
committed
Fix TorrentFilesTreeTest
1 parent 503d707 commit c3b2b21

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

torrentfile/src/test/kotlin/org/equeim/tremotesf/torrentfile/TorrentFilesTreeTest.kt

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -590,20 +590,22 @@ class TorrentFilesTreeTest {
590590
val isInItems = currentNodePublic.children.contains(renamedNode)
591591
val oldItems = items.value
592592

593-
val expectedOriginalPath = getItemNamePath(renamedNode.item)
593+
val expectedOriginalNamePath = getItemNamePath(renamedNode.item)
594594
val expectedNewName = "foo"
595595
var callbackCalled = false
596-
onFileRenamedCallback = { nodePath, originalPath, newName ->
597-
if (nodePath == renamedNode.path && originalPath == expectedOriginalPath && newName == expectedNewName) {
598-
callbackCalled = true
599-
}
596+
onFileRenamedCallback = { nodePath, originalNamePath, newName ->
597+
assertEquals(renamedNode.path, nodePath)
598+
assertEquals(expectedOriginalNamePath, originalNamePath)
599+
assertEquals(expectedNewName, newName)
600+
callbackCalled = true
600601
}
601602

602603
renameFile(renamedNode.path, expectedNewName)
603604
runCurrent()
604605

605606
mustChange.assertThatItemsChanged { assertEquals(expectedNewName, it.name) }
606607
mustNotChange.assertThatItemsAreNotChanged()
608+
assertTrue(callbackCalled)
607609

608610
if (isInItems) {
609611
assertNotEquals(oldItems, items.value)
@@ -777,8 +779,9 @@ class TorrentFilesTreeTest {
777779
}
778780

779781
var onFileRenamedCallback: (NodePath, String, String) -> Unit = { _, _, _ -> }
780-
override fun onFileRenamed(path: NodePath, originalPath: String, newName: String) {
781-
println("onFileRenamed called with: originalPath = $originalPath, newName = $newName")
782+
override fun onFileRenamed(path: NodePath, originalNamePath: String, newName: String) {
783+
println("onFileRenamed called with: originalPath = $originalNamePath, newName = $newName")
784+
onFileRenamedCallback(path, originalNamePath, newName)
782785
}
783786
}
784787
}

0 commit comments

Comments
 (0)