Skip to content

Commit

Permalink
chore: test directory exists but has two different files
Browse files Browse the repository at this point in the history
  • Loading branch information
guicamest committed Oct 12, 2023
1 parent b14c204 commit b296c3b
Showing 1 changed file with 26 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import org.junit.jupiter.api.DisplayName
import org.junit.jupiter.api.Nested
import java.nio.file.Paths
import kotlin.io.path.createTempDirectory
import kotlin.io.path.createTempFile
import kotlin.io.path.writeText
import kotlin.test.Test

@DisplayName("DuplicateFinder should")
Expand Down Expand Up @@ -38,6 +40,30 @@ class DuplicateFinderTest {
assertThat(execution.duplicateEntries()).isEmpty()
}
}

@Test
fun `directory exists but has only one file`(){
val directoryWithOneFile = createTempDirectory("directoryWithOneFile")
assertThat(createTempFile(directory = directoryWithOneFile)).exists().isRegularFile()

val execution = duplicateFinder.find(listOf(directoryWithOneFile))
runTest {
assertThat(execution.duplicateEntries()).isEmpty()
}
}

@Test
fun `directory exists but has two different files`(){
val directoryWith2DifferentFiles = createTempDirectory("directoryWith2DifferentFiles")
createTempFile(directory = directoryWith2DifferentFiles).writeText("hi")
createTempFile(directory = directoryWith2DifferentFiles).writeText("bye")

val execution = duplicateFinder.find(listOf(directoryWith2DifferentFiles))
runTest {
assertThat(execution.duplicateEntries()).isEmpty()
}
}

}

}

0 comments on commit b296c3b

Please sign in to comment.