callbag-start-with
Advanced tools
Comparing version 2.1.0 to 2.1.1
{ | ||
"name": "callbag-start-with", | ||
"version": "2.1.0", | ||
"version": "2.1.1", | ||
"description": "Callbag operator that seeds a source with an initial data output", | ||
@@ -19,7 +19,7 @@ "repository": { | ||
"devDependencies": { | ||
"callbag-for-each": "~1.0.1", | ||
"callbag-from-iter": "~1.0.0", | ||
"callbag-for-each": "~1.0.1", | ||
"callbag-mock": "^1.0.0", | ||
"callbag-mock": "^2.1.0", | ||
"tape": "^4.8.0" | ||
} | ||
} |
51
test.js
@@ -8,8 +8,5 @@ const test = require('tape'); | ||
test('it seeds the source with initial value, then passes the rest on down', t => { | ||
let history = []; | ||
const report = (name,dir,t,d) => t !== 0 && d !== undefined && history.push([name,dir,t,d]); | ||
const source = makeMockCallbag('source', true); | ||
const source = makeMockCallbag(true); | ||
const seedWithFoo = startWith('foo'); | ||
const sink = makeMockCallbag('sink', report); | ||
const sink = makeMockCallbag(); | ||
@@ -22,9 +19,8 @@ seedWithFoo(source)(0, sink); | ||
t.deepEqual(history, [ | ||
['sink', 'body', 1, 'foo'], | ||
['sink', 'body', 1, 'bar'], | ||
['sink', 'body', 1, 'baz'], | ||
['sink', 'body', 2, 'error'], | ||
], 'sink gets seed and subsequent data'); | ||
t.deepEqual( | ||
sink.getReceivedData(), | ||
['foo','bar','baz'], | ||
'sink gets seed and subsequent data' | ||
); | ||
t.ok(!sink.checkConnection(), 'sink gets termination'); | ||
t.end(); | ||
@@ -35,7 +31,7 @@ }); | ||
let history = []; | ||
const report = (name,dir,t,d) => t !== 0 && history.push([name,dir,t,d]); | ||
const report = (t,d) => t !== 0 && history.push([t,d]); | ||
const source = makeMockCallbag('source', report, true); | ||
const source = makeMockCallbag(report, true); | ||
const seedWithFoo = startWith('foo'); | ||
const sink = makeMockCallbag('sink', report); | ||
const sink = makeMockCallbag(); | ||
@@ -48,5 +44,4 @@ seedWithFoo(source)(0, sink); | ||
t.deepEqual(history, [ | ||
['sink', 'body', 1, 'foo'], | ||
['source', 'talkback', 1, undefined], | ||
['source', 'talkback', 2, undefined], | ||
[1, undefined], | ||
[2, undefined], | ||
], 'source gets requests from sink'); | ||
@@ -72,8 +67,5 @@ | ||
test('it supports multiple arguments', t => { | ||
let history = []; | ||
const report = (name,dir,t,d) => t !== 0 && d !== undefined && history.push([name,dir,t,d]); | ||
const source = makeMockCallbag('source', true); | ||
const source = makeMockCallbag(true); | ||
const seedWithMultipleEmits = startWith('foo', 'bar', 'baz'); | ||
const sink = makeMockCallbag('sink', report); | ||
const sink = makeMockCallbag(); | ||
@@ -83,13 +75,10 @@ seedWithMultipleEmits(source)(0, sink); | ||
source.emit(1, 'qu'); | ||
source.emit(2, 'error'); | ||
t.deepEqual(history, [ | ||
['sink', 'body', 1, 'foo'], | ||
['sink', 'body', 1, 'bar'], | ||
['sink', 'body', 1, 'baz'], | ||
['sink', 'body', 1, 'qu'], | ||
['sink', 'body', 2, 'error'], | ||
], 'sink gets seed and subsequent data'); | ||
t.deepEqual( | ||
sink.getReceivedData(), | ||
['foo','bar','baz','qu'], | ||
'sink gets seed and subsequent data' | ||
); | ||
t.end(); | ||
}); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
4573
75