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

Potentially buggy test #199

Open
fabiospampinato opened this issue Apr 15, 2022 · 0 comments
Open

Potentially buggy test #199

fabiospampinato opened this issue Apr 15, 2022 · 0 comments
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@fabiospampinato
Copy link

fabiospampinato commented Apr 15, 2022

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?

@luwes luwes added bug Something isn't working help wanted Extra attention is needed labels Sep 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants