Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

testing case: merge on atomic update #30

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -451,6 +451,18 @@ function fastUpdate(s, n) {
assert(s1and2.end());
assert.deepEqual(result, [12, 2, 4, 44, 1, 12, 2]);
});
it('emmits all events from atomic update', function () {
var result = [];
var a = stream(1);
var b = stream([a], function() { return a() * 2; });
var c = stream([a], function() { return a() + 4; });
var d = flyd.merge(b, c);
stream([d], function () {
result.push(d());
});
a(2);
assert.deepEqual(result, [2, 5, 4, 6]);
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here I suppose that events will be emitted in the same order as streams provided to flyd.merge.
Should that be like that? Or maybe opposite order, because of curry-in-mind API? Or maybe it should depends on order of stream declarations?

});
});
describe('ap', function() {
it('applies functions in stream', function() {
Expand Down