jstest
jstest copied to clipboard
Enumerable.areEqual(expectedPromise, actualPromise) returns allways true
var JS = require('jstest');
JS.Test.describe('Enumerable.areEqual comparing Promises', function () { with(this) {
before(function() { with(this) {
this.promises = [
new Promise(function (r) { r('a'); }),
new Promise(function (_, r) { r('a'); })
];
}});
it('should return true on the same promise', function () { with(this) {
assert(JS.Enumerable.areEqual(promises[0], promises[0]));
}});
it('should return false on two different promises', function () { with(this) {
assertNot(JS.Enumerable.areEqual(promises[0], promises[1]));
}});
}});
JS.Test.autorun();
The second one will fail, because Promises have no iterable keys on them.
So the loop at /build/jstest.js#L1483 won't run.
What were you actually trying to test when you discovered this? Can you show me a genuine test case?
I cant show you any code, that i would recommend anyone to actually use somewhere. Just discovered this on a "play-around" session in the debugger, how i'd call it.
Just wanted to let you know, in case you don't see any value in this change, just close it.
I guess I just wanted to know what you expected that call to do. It is possible to add support for this (in theory, I can't commit to doing it any time soon but I can imagine how it could work) so any info you have would be useful.