simplify streams, lint docs
This commit is contained in:
parent
a7f8018df9
commit
6ce2a384ec
20 changed files with 1271 additions and 2132 deletions
43
stream/tests/test-scanMerge.js
Normal file
43
stream/tests/test-scanMerge.js
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
"use strict"
|
||||
|
||||
var o = require("../../ospec/ospec")
|
||||
var stream = require("../stream")
|
||||
var scanMerge = require("../scanMerge")
|
||||
|
||||
o.spec("scanMerge", function() {
|
||||
o("defaults to seed", function() {
|
||||
var parent1 = stream()
|
||||
var parent2 = stream()
|
||||
|
||||
var child = scanMerge([
|
||||
[parent1, function(out, p1) {
|
||||
return out + p1
|
||||
}],
|
||||
[parent2, function(out, p2) {
|
||||
return out + p2
|
||||
}]
|
||||
], -10)
|
||||
|
||||
o(child()).equals(-10)
|
||||
})
|
||||
|
||||
o("accumulates as expected", function() {
|
||||
var parent1 = stream()
|
||||
var parent2 = stream()
|
||||
|
||||
var child = scanMerge([
|
||||
[parent1, function(out, p1) {
|
||||
return out + p1
|
||||
}],
|
||||
[parent2, function(out, p2) {
|
||||
return out + p2 + p2
|
||||
}]
|
||||
], "a")
|
||||
|
||||
parent1("b")
|
||||
parent2("c")
|
||||
parent1("b")
|
||||
|
||||
o(child()).equals("abccb")
|
||||
})
|
||||
})
|
||||
Loading…
Add table
Add a link
Reference in a new issue