Skip to content

Commit

Permalink
test(ort-utils): Add missing tests for LocalFileStorage
Browse files Browse the repository at this point in the history
Signed-off-by: Martin Nonnenmacher <martin.nonnenmacher@bosch.com>
  • Loading branch information
mnonnenmacher authored and sschuberth committed Sep 3, 2024
1 parent af56607 commit 8e05bcf
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions utils/ort/src/funTest/kotlin/storage/LocalFileStorageFunTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,22 @@ class LocalFileStorageFunTest : WordSpec({
}
}

"exists()" should {
"return true if the file exists" {
storage { storage, directory ->
directory.resolve("existing-file").writeText("content")

storage.exists("existing-file") shouldBe true
}
}

"return false if the file does not exist" {
storage { storage, _ ->
storage.exists("file-does-not-exist") shouldBe false
}
}
}

"read()" should {
"succeed if the file exists" {
storage { storage, directory ->
Expand Down Expand Up @@ -146,4 +162,23 @@ class LocalFileStorageFunTest : WordSpec({
}
}
}

"delete()" should {
"return true if the file exists" {
storage { storage, directory ->
val file = directory.resolve("file")
file.writeText("content")

storage.delete("file") shouldBe true

file shouldNot exist()
}
}

"return false if the file does not exist" {
storage { storage, _ ->
storage.delete("file-does-not-exist") shouldBe false
}
}
}
})

0 comments on commit 8e05bcf

Please sign in to comment.