mirror of
https://github.com/Dvorinka/ClubLogos.git
synced 2026-10-28 16:11:16 +00:00
fff
This commit is contained in:
1 parent
0fc92f8464
commit
cdb8bcd3e9
5928 files changed
+1054476
-72
No files matched your search
+41
@@ -0,0 +1,41 @@
|
||||
var concat = require('../')
|
||||
var stream = require('stream')
|
||||
var test = require('tape')
|
||||
|
||||
test('basic', function (t) {
|
||||
t.plan(2)
|
||||
var s = new stream.PassThrough()
|
||||
concat(s, function (err, buf) {
|
||||
t.error(err)
|
||||
t.deepEqual(buf, Buffer.from('abc123456789'))
|
||||
})
|
||||
s.write('abc')
|
||||
setTimeout(function () {
|
||||
s.write('123')
|
||||
}, 10)
|
||||
setTimeout(function () {
|
||||
s.write('456')
|
||||
}, 20)
|
||||
setTimeout(function () {
|
||||
s.end('789')
|
||||
}, 30)
|
||||
})
|
||||
|
||||
test('error', function (t) {
|
||||
t.plan(2)
|
||||
var s = new stream.PassThrough()
|
||||
concat(s, function (err, buf) {
|
||||
t.ok(err, 'got expected error')
|
||||
t.ok(!buf)
|
||||
})
|
||||
s.write('abc')
|
||||
setTimeout(function () {
|
||||
s.write('123')
|
||||
}, 10)
|
||||
setTimeout(function () {
|
||||
s.write('456')
|
||||
}, 20)
|
||||
setTimeout(function () {
|
||||
s.emit('error', new Error('error'))
|
||||
}, 30)
|
||||
})
|
||||
Reference in new issue
Block a user