mirror of
https://github.com/bcomnes/deploy-to-neocities.git
synced 2026-01-17 06:56:30 +00:00
22 lines
408 B
JavaScript
22 lines
408 B
JavaScript
const tape = require('tape')
|
|
const { Readable } = require('../')
|
|
|
|
tape('streams are async iterators', async function (t) {
|
|
const data = ['a', 'b', 'c', null]
|
|
const expected = data.slice(0)
|
|
|
|
const r = new Readable({
|
|
read (cb) {
|
|
this.push(data.shift())
|
|
cb(null)
|
|
}
|
|
})
|
|
|
|
for await (const chunk of r) {
|
|
t.same(chunk, expected.shift())
|
|
}
|
|
|
|
t.same(expected, [null])
|
|
t.end()
|
|
})
|