mirror of
https://github.com/mgerb/mywebsite
synced 2026-01-13 19:12:49 +00:00
updated package.json
This commit is contained in:
54
node_modules/event-stream/test/pipe.async.js
generated
vendored
Normal file
54
node_modules/event-stream/test/pipe.async.js
generated
vendored
Normal file
@@ -0,0 +1,54 @@
|
||||
var es = require('event-stream')
|
||||
, it = require('it-is').style('colour')
|
||||
, d = require('d-utils')
|
||||
|
||||
function makeExamplePipe() {
|
||||
|
||||
return es.pipe(
|
||||
es.map(function (data, callback) {
|
||||
callback(null, data * 2)
|
||||
}),
|
||||
es.map(function (data, callback) {
|
||||
d.delay(callback)(null, data)
|
||||
}),
|
||||
es.map(function (data, callback) {
|
||||
callback(null, data + 2)
|
||||
}))
|
||||
}
|
||||
|
||||
exports['simple pipe'] = function (test) {
|
||||
|
||||
var pipe = makeExamplePipe()
|
||||
|
||||
pipe.on('data', function (data) {
|
||||
it(data).equal(18)
|
||||
test.done()
|
||||
})
|
||||
|
||||
pipe.write(8)
|
||||
|
||||
}
|
||||
|
||||
exports['read array then map'] = function (test) {
|
||||
|
||||
var readThis = d.map(3, 6, 100, d.id) //array of multiples of 3 < 100
|
||||
, first = es.readArray(readThis)
|
||||
, read = []
|
||||
, pipe =
|
||||
es.pipe(
|
||||
first,
|
||||
es.map(function (data, callback) {
|
||||
callback(null, {data: data})
|
||||
}),
|
||||
es.map(function (data, callback) {
|
||||
callback(null, {data: data})
|
||||
}),
|
||||
es.writeArray(function (err, array) {
|
||||
it(array).deepEqual(d.map(readThis, function (data) {
|
||||
return {data: {data: data}}
|
||||
}))
|
||||
test.done()
|
||||
})
|
||||
)
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user