summaryrefslogtreecommitdiff
path: root/cli/js/files_test.ts
diff options
context:
space:
mode:
authorBartek IwaƄczuk <biwanczuk@gmail.com>2020-02-29 18:45:47 +0100
committerGitHub <noreply@github.com>2020-02-29 18:45:47 +0100
commitf55b22e195ff0dfaf117aaef2a0fcc51fe0058c8 (patch)
treec314180b02b1ebf6b3f75ccbb4decade3b4fb511 /cli/js/files_test.ts
parent199fb195f334b582e4ee3fccaa9a33aa2a06ca48 (diff)
add assertResources sanitizer to cli/js/ unit tests (#4161)
Diffstat (limited to 'cli/js/files_test.ts')
-rw-r--r--cli/js/files_test.ts9
1 files changed, 9 insertions, 0 deletions
diff --git a/cli/js/files_test.ts b/cli/js/files_test.ts
index de0d3019a..7e3479798 100644
--- a/cli/js/files_test.ts
+++ b/cli/js/files_test.ts
@@ -21,6 +21,7 @@ testPerm({ read: true }, async function filesCopyToStdout(): Promise<void> {
const fileSize = Deno.statSync(filename).len;
assertEquals(bytesWritten, fileSize);
console.log("bytes written", bytesWritten);
+ file.close();
});
testPerm({ read: true }, async function filesToAsyncIterator(): Promise<void> {
@@ -33,6 +34,7 @@ testPerm({ read: true }, async function filesToAsyncIterator(): Promise<void> {
}
assertEquals(totalSize, 12);
+ file.close();
});
test(async function readerToAsyncIterator(): Promise<void> {
@@ -308,6 +310,7 @@ testPerm({ read: true }, async function seekStart(): Promise<void> {
await file.read(buf);
const decoded = new TextDecoder().decode(buf);
assertEquals(decoded, "world!");
+ file.close();
});
testPerm({ read: true }, function seekSyncStart(): void {
@@ -321,6 +324,7 @@ testPerm({ read: true }, function seekSyncStart(): void {
file.readSync(buf);
const decoded = new TextDecoder().decode(buf);
assertEquals(decoded, "world!");
+ file.close();
});
testPerm({ read: true }, async function seekCurrent(): Promise<void> {
@@ -334,6 +338,7 @@ testPerm({ read: true }, async function seekCurrent(): Promise<void> {
await file.read(buf);
const decoded = new TextDecoder().decode(buf);
assertEquals(decoded, "world!");
+ file.close();
});
testPerm({ read: true }, function seekSyncCurrent(): void {
@@ -347,6 +352,7 @@ testPerm({ read: true }, function seekSyncCurrent(): void {
file.readSync(buf);
const decoded = new TextDecoder().decode(buf);
assertEquals(decoded, "world!");
+ file.close();
});
testPerm({ read: true }, async function seekEnd(): Promise<void> {
@@ -357,6 +363,7 @@ testPerm({ read: true }, async function seekEnd(): Promise<void> {
await file.read(buf);
const decoded = new TextDecoder().decode(buf);
assertEquals(decoded, "world!");
+ file.close();
});
testPerm({ read: true }, function seekSyncEnd(): void {
@@ -367,6 +374,7 @@ testPerm({ read: true }, function seekSyncEnd(): void {
file.readSync(buf);
const decoded = new TextDecoder().decode(buf);
assertEquals(decoded, "world!");
+ file.close();
});
testPerm({ read: true }, async function seekMode(): Promise<void> {
@@ -387,4 +395,5 @@ testPerm({ read: true }, async function seekMode(): Promise<void> {
const buf = new Uint8Array(1);
await file.read(buf); // "H"
assertEquals(new TextDecoder().decode(buf), "H");
+ file.close();
});