Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge pull request #885 from aheckmann/mongo2.1

[ready] make tests Mongo 2.1 compatible
  • Loading branch information...
commit f5ae2dfdf0dbc32d21c880202e32dad293cbafe1 2 parents 75679ed + 7ff620f
@rauchg rauchg authored
Showing with 9 additions and 7 deletions.
  1. +2 −0  test/model.test.js
  2. +7 −7 test/shard.test.js
View
2  test/model.test.js
@@ -4304,6 +4304,7 @@ module.exports = {
var db = start();
db.on('error', function (err) {
+ if (/connection closed/.test(err.message)) return;
/^E11000 duplicate key error index:/.test(err.message).should.equal(true);
db.close();
});
@@ -4725,4 +4726,5 @@ module.exports = {
});
})
}
+
};
View
14 test/shard.test.js
@@ -119,38 +119,38 @@ var tests = {
P.create({ name: 'ryu', likes: ['street fighting']}, function (err, ryu) {
--pending || db.close();
should.exist(err);
- err.message.should.equal('tried to insert object with no valid shard key');
+ /tried to insert object with no valid shard key/.test(err.message).should.be.true;
});
P.create({ likes: ['street fighting']}, function (err, ryu) { should.exist(err);
--pending || db.close();
should.exist(err);
- err.message.should.equal('tried to insert object with no valid shard key');
+ /tried to insert object with no valid shard key/.test(err.message).should.be.true;
});
P.create({ name: 'ryu' }, function (err, ryu) { should.exist(err);
--pending || db.close();
should.exist(err);
- err.message.should.equal('tried to insert object with no valid shard key');
+ /tried to insert object with no valid shard key/.test(err.message).should.be.true;
});
P.create({ age: 49 }, function (err, ryu) { should.exist(err);
--pending || db.close();
should.exist(err);
- err.message.should.equal('tried to insert object with no valid shard key');
+ /tried to insert object with no valid shard key/.test(err.message).should.be.true;
});
P.create({ likes: ['street fighting'], age: 8 }, function (err, ryu) {
--pending || db.close();
should.exist(err);
- err.message.should.equal('tried to insert object with no valid shard key');
+ /tried to insert object with no valid shard key/.test(err.message).should.be.true;
});
var p = new P;
p.save(function (err) {
--pending || db.close();
should.exist(err);
- err.message.should.equal('tried to insert object with no valid shard key');
+ /tried to insert object with no valid shard key/.test(err.message).should.be.true;
});
},
@@ -164,7 +164,7 @@ var tests = {
P.update({ _id: ken._id }, { likes: ['kicking', 'punching'] }, function (err) {
should.exist(err);
- "right object doesn't have full shard key".should.equal(err.message);
+ /doesn't have full shard key/.test(err.message).should.be.true;
P.update({ _id: ken._id, name: 'ken' }, { likes: ['kicking', 'punching'] }, function (err) {
should.exist(err);
Please sign in to comment.
Something went wrong with that request. Please try again.