Permalink
Browse files

Merge branch 'mongo2.1.1' into newmaster

Conflicts:
	test/shard.test.js
  • Loading branch information...
1 parent d932343 commit 15fc3ec8480f85ce2a643ac58cd1d0cede13cdc4 @aheckmann aheckmann committed May 30, 2012
Showing with 17 additions and 18 deletions.
  1. +17 −18 test/shard.test.js
View
@@ -1,6 +1,7 @@
var start = require('./common')
, should = require('should')
+ , assert = require('assert')
, random = require('../lib/utils').random
, mongoose = start.mongoose
, Mongoose = mongoose.Mongoose
@@ -30,7 +31,6 @@ mongoose.model('ShardPerson', schema, collection);
var db = start({ uri: uri });
db.on('open', function () {
-
// set up a sharded test collection
var P = db.model('ShardPerson', collection);
@@ -118,38 +118,38 @@ var tests = {
P.create({ name: 'ryu', likes: ['street fighting']}, function (err, ryu) {
--pending || db.close();
- should.exist(err);
+ assert.ok(err);
/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);
+ P.create({ likes: ['street fighting']}, function (err, ryu) { assert.ok(err);
--pending || db.close();
- should.exist(err);
+ assert.ok(err);
/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);
+ P.create({ name: 'ryu' }, function (err, ryu) { assert.ok(err);
--pending || db.close();
- should.exist(err);
+ assert.ok(err);
/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);
+ P.create({ age: 49 }, function (err, ryu) { assert.ok(err);
--pending || db.close();
- should.exist(err);
+ assert.ok(err);
/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);
+ assert.ok(err);
/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);
+ assert.ok(err);
/tried to insert object with no valid shard key/.test(err.message).should.be.true;
});
@@ -162,19 +162,18 @@ var tests = {
P.create({ name: 'ken', age: 27 }, function (err, ken) {
should.strictEqual(null, err);
- P.update({ _id: ken._id }, { likes: ['kicking', 'punching'] }, function (err) {
- should.exist(err);
- /doesn't have full shard key/.test(err.message).should.be.true;
+ P.update({ name: 'ken' }, { likes: ['kicking', 'punching'] }, function (err) {
+ /full shard key/.test(err.message).should.be.true;
P.update({ _id: ken._id, name: 'ken' }, { likes: ['kicking', 'punching'] }, function (err) {
- should.exist(err);
+ assert.ok(!err);
P.update({ _id: ken._id, age: 27 }, { likes: ['kicking', 'punching'] }, function (err) {
- should.exist(err);
+ assert.ok(!err);
P.update({ age: 27 }, { likes: ['kicking', 'punching'] }, function (err) {
db.close();
- should.exist(err);
+ assert.ok(err);
});
});
});
@@ -193,7 +192,7 @@ var tests = {
chunli.age = 20;
chunli.save(function (err) {
- /^Can't modify shard key's value field/.test(err.message).should.be.true;
+ /^Can't modify shard key's value/.test(err.message).should.be.true;
chunli._shardval.name.should.equal('chun li');
chunli._shardval.age.should.equal(19);
@@ -207,7 +206,7 @@ var tests = {
chunli.name='chuuuun liiiii';
chunli.save(function (err) {
db.close();
- /^Can't modify shard key's value field/.test(err.message).should.be.true;
+ /^Can't modify shard key's value/.test(err.message).should.be.true;
});
});
});

0 comments on commit 15fc3ec

Please sign in to comment.