Fix tinytest include to use _.isEqual

This commit is contained in:
Naomi Seyfer
2013-01-04 15:18:23 -08:00
committed by David Glasser
parent 3068fd1a36
commit 76dba0150d
2 changed files with 4 additions and 3 deletions

View File

@@ -917,7 +917,7 @@ Tinytest.add("livedata stub - multiple stubs same doc", function (test) {
// Method sent.
var updateMethodId = testGotMessage(
test, stream, {msg: 'method', method: 'updateIt',
params: [{$type: 'oid', $value: stubWrittenId.valueOf()}], id: '*'});
params: [stubWrittenId], id: '*'});
test.equal(stream.sent.length, 0);
// Get some data... slightly different than what we wrote.

View File

@@ -205,7 +205,7 @@ _.extend(TestCaseResults.prototype, {
include: function (s, v) {
var pass = false;
if (s instanceof Array)
pass = _.indexOf(s, v) !== -1;
pass = _.any(s, function(it) {return _.isEqual(v, it);});
else if (typeof s === "object")
pass = v in s;
else if (typeof s === "string")
@@ -218,8 +218,9 @@ _.extend(TestCaseResults.prototype, {
/* fail -- not something that contains other things */;
if (pass)
this.ok();
else
else {
this.fail({type: "include", sequence: s, should_contain_value: v});
}
},
// XXX should change to lengthOf to match vowsjs