You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
61 lines
922 B
61 lines
922 B
var pull = require('pull-stream') |
|
var tape = require('tape') |
|
var Live = require('./') |
|
|
|
var Pushable = require('pull-pushable') |
|
|
|
tape('old only', function (t) { |
|
|
|
var olds = pull.values([1,2,3]) |
|
|
|
Live(function () { |
|
t.ok(true) |
|
return olds |
|
}, function () { |
|
throw new Error('should not be called') |
|
})({old: true}) |
|
|
|
t.end() |
|
|
|
}) |
|
|
|
tape('new only', function (t) { |
|
|
|
var news = Pushable() |
|
|
|
Live(function () { |
|
throw new Error('should not be called') |
|
}, function () { |
|
t.ok(true) |
|
return news |
|
})({old: false}) |
|
|
|
t.end() |
|
|
|
}) |
|
|
|
|
|
tape('old and new', function (t) { |
|
|
|
var olds = pull.values([1,2,3]) |
|
var news = Pushable() |
|
pull( |
|
Live(function () { |
|
return olds |
|
}, function () { |
|
t.ok(true) |
|
return news |
|
})({live: true, sync: false}), |
|
pull.collect(function (err, ary) { |
|
t.deepEqual(ary, [1,2,3,4]) |
|
t.end() |
|
}) |
|
) |
|
|
|
news.push(4) |
|
news.end() |
|
}) |
|
|
|
|
|
|
|
|
|
|