1 | const assert = require('assert')
|
2 | const Writable = require('stream').Writable
|
3 | const wrote = require('../')
|
4 |
|
5 | const testString = 'hello world'
|
6 | const buffer = Buffer.from(testString)
|
7 | const allRawData = []
|
8 | const ws = new Writable({
|
9 | write: (chunk, encoding, next) => {
|
10 | allRawData.push(chunk)
|
11 | next()
|
12 | },
|
13 | })
|
14 | wrote.write(ws, buffer)
|
15 | .then(() => {
|
16 | console.log(allRawData.map(d => String(d)))
|
17 | assert.deepEqual(allRawData, [
|
18 | buffer,
|
19 | ])
|
20 | })
|
21 | .catch(console.error)
|