Skip to content

Commit

Permalink
No need for a timer
Browse files Browse the repository at this point in the history
  • Loading branch information
mmastrac committed Nov 13, 2023
1 parent becc685 commit ab1d8c7
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions cli/tests/unit/text_encoding_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -330,16 +330,13 @@ Deno.test(
permissions: { read: true },
},
async function textDecoderStreamCleansUpOnCancel() {
let timeout: number | undefined = undefined;
let cancelled = false;
const readable = new ReadableStream({
start: (controller) => {
controller.enqueue(new Uint8Array(12));
// This will never be called
timeout = setTimeout(() => controller.close());
},
cancel: () => {
clearTimeout(timeout);
timeout = undefined;
cancelled = true;
},
}).pipeThrough(new TextDecoderStream());
const chunks = [];
Expand All @@ -350,6 +347,6 @@ Deno.test(
}
assertEquals(chunks.length, 1);
assertEquals(chunks[0].length, 12);
assertStrictEquals(timeout, undefined);
assertStrictEquals(cancelled, true);
},
);

0 comments on commit ab1d8c7

Please sign in to comment.