Skip to content

Commit

Permalink
fixup
Browse files Browse the repository at this point in the history
  • Loading branch information
climba03003 committed Mar 29, 2024
1 parent ea1951b commit 1664f00
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions test/utils.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ test('isGzip() utility should be able to detect gzip compressed Buffer', async (
})

test('intoAsyncIterator() utility should handle different data', async (t) => {
t.plan(15)
t.plan(8)

const buf = Buffer.from('foo')
const str = 'foo'
Expand All @@ -73,6 +73,7 @@ test('intoAsyncIterator() utility should handle different data', async (t) => {
const asyncIterator = (async function * () {
yield str
})()
const obj = {}

for await (const buffer of intoAsyncIterator(buf)) {
t.equal(buffer, buf)
Expand All @@ -87,14 +88,18 @@ test('intoAsyncIterator() utility should handle different data', async (t) => {
}

for await (const chunk of intoAsyncIterator(arrayBuffer)) {
t.equal(chunk, 0)
t.equal(chunk.toString(), Buffer.from(arrayBuffer).toString())
}

for await (const chunk of intoAsyncIterator(typedArray)) {
t.equal(chunk, 0)
t.equal(chunk.toString(), Buffer.from(typedArray).toString())
}

for await (const chunk of intoAsyncIterator(asyncIterator)) {
t.equal(chunk, str)
}

for await (const chunk of intoAsyncIterator(obj)) {
t.equal(chunk, obj)
}
})

0 comments on commit 1664f00

Please sign in to comment.