diff options
Diffstat (limited to 'cli/tests/unit/write_file_test.ts')
-rw-r--r-- | cli/tests/unit/write_file_test.ts | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/cli/tests/unit/write_file_test.ts b/cli/tests/unit/write_file_test.ts index 0c3ff491d..78d0f5bad 100644 --- a/cli/tests/unit/write_file_test.ts +++ b/cli/tests/unit/write_file_test.ts @@ -393,3 +393,19 @@ function pathExists(path: string | URL) { return false; } } + +Deno.test( + { permissions: { read: true, write: true } }, + async function writeFileStream() { + const stream = new ReadableStream({ + pull(controller) { + controller.enqueue(new Uint8Array([1])); + controller.enqueue(new Uint8Array([2])); + controller.close(); + }, + }); + const filename = Deno.makeTempDirSync() + "/test.txt"; + await Deno.writeFile(filename, stream); + assertEquals(Deno.readFileSync(filename), new Uint8Array([1, 2])); + }, +); |