Skip to content

Commit

Permalink
uglify stream generator
Browse files Browse the repository at this point in the history
  • Loading branch information
LiviaMedeiros committed Sep 5, 2023
1 parent c2f9120 commit 6670b36
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions test/sequence.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,17 @@ const getNumber = () => [
: new Int16Array(textEncoder.encode(`${_i++}`).buffer),
][Math.floor(Math.random() * 4)]();

const bodygen = (n = 10, pause = 9) => {
let $ = null;
return new ReadableStream({
const bodygen = (n = 10, pause = 9, $ = null) =>
new ReadableStream({
start: _ =>
$ = setInterval(
$ ??= setInterval(
() => n--
? _.enqueue(getNumber())
: (_.close(), clearInterval($)),
pause
),
cancel: () => clearInterval($),
});
};

const validate = (actual, expected = {}, headers = {}) => {
assert.ok(actual instanceof Response, `${actual} is not Response`);
Expand Down

0 comments on commit 6670b36

Please sign in to comment.