Skip to content

Potentially buggy test #199

@fabiospampinato

Description

@fabiospampinato

The following test looks buggy to me:

test('insures that new dependencies are updated before dependee', function(t) {
var order = '';
var a = o(0);
var b = S(function x() {
order += 'b';
console.log('B');
return a() + 1;
});
var c = S(function y() {
order += 'c';
console.log('C');
return b() || d();
});
function z() {
order += 'd';
console.log('D');
return a() + 10;
}
var d = S(z);
t.equal(order, 'bcd', '1st bcd test');
order = '';
a(-1);
t.equal(b(), 0, 'b equals 0');
t.equal(order, 'bcd', '2nd bcd test');
t.equal(d(), 9, 'd equals 9');
t.equal(c(), 9, 'c equals d(9)');
order = '';
a(0);
t.equal(order, 'bc', '3rd bcd test');
t.equal(c(), 1);
t.end();
});

At line 264 we are basically just updating the observable from -1 to 0. The D computed depends only on this observable and returns observable+10. Then at line 266 we say the D computed shouldn't have run, why shouldn't it?

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinghelp wantedExtra attention is needed

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions