summaryrefslogtreecommitdiff
path: root/tests/unit_node/_fs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/unit_node/_fs')
-rw-r--r--tests/unit_node/_fs/_fs_copy_test.ts12
1 files changed, 11 insertions, 1 deletions
diff --git a/tests/unit_node/_fs/_fs_copy_test.ts b/tests/unit_node/_fs/_fs_copy_test.ts
index 036091303..adc002187 100644
--- a/tests/unit_node/_fs/_fs_copy_test.ts
+++ b/tests/unit_node/_fs/_fs_copy_test.ts
@@ -2,7 +2,7 @@
import * as path from "@std/path/mod.ts";
import { assert } from "@std/assert/mod.ts";
import { assertCallbackErrorUncaught } from "../_test_utils.ts";
-import { copyFile, copyFileSync, existsSync } from "node:fs";
+import { copyFile, copyFileSync, cpSync, existsSync } from "node:fs";
const destFile = "./destination.txt";
@@ -50,3 +50,13 @@ Deno.test("[std/node/fs] copyFile callback isn't called twice if error is thrown
},
});
});
+
+Deno.test("[std/node/fs] cp creates destination directory", async () => {
+ const tempDir = await Deno.makeTempDir();
+ const tempFile1 = path.join(tempDir, "file1.txt");
+ const tempFile2 = path.join(tempDir, "dir", "file2.txt");
+ await Deno.writeTextFile(tempFile1, "hello world");
+ cpSync(tempFile1, tempFile2);
+ assert(existsSync(tempFile2));
+ await Deno.remove(tempDir, { recursive: true });
+});