Skip to content

Commit

Permalink
Fixed ci build
Browse files Browse the repository at this point in the history
  • Loading branch information
viktor-podzigun committed Sep 29, 2021
1 parent d32ae95 commit bed9ef9
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions showcase/src/test/scala/scommons/nodejs/FSSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -36,28 +36,30 @@ class FSSpec extends AsyncTestSpec {

it should "fail if newPath is dir when rename" in {
//given
val tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), "scommons-nodejs-"))
fs.existsSync(tmpDir) shouldBe true
val tmpDir1 = fs.mkdtempSync(path.join(os.tmpdir(), "scommons-nodejs-"))
val tmpDir2 = fs.mkdtempSync(path.join(os.tmpdir(), "scommons-nodejs-"))
fs.existsSync(tmpDir1) shouldBe true

val file = path.join(tmpDir, "example.txt")
val file = path.join(tmpDir1, "example.txt")
fs.writeFileSync(file, "hello, World!!!")
fs.existsSync(file) shouldBe true

val oldPath = file
val newPath = os.homedir()
val newPath = tmpDir2

//when
val result = fs.rename(oldPath, newPath)

//then
result.failed.map {
case JavaScriptException(error) =>
error.toString should include ("operation not permitted")
error.toString should include ("EISDIR: illegal operation on a directory")
}.andThen {
case _ =>
//cleanup
fs.unlinkSync(file)
fs.rmdirSync(tmpDir)
fs.rmdirSync(tmpDir1)
fs.rmdirSync(tmpDir2)
}
}

Expand Down

0 comments on commit bed9ef9

Please sign in to comment.