Skip to content

Commit

Permalink
test: fix tests re: #8481
Browse files Browse the repository at this point in the history
  • Loading branch information
vkarpov15 committed Mar 23, 2020
1 parent b84a338 commit 105c8ae
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 8 deletions.
4 changes: 2 additions & 2 deletions test/timestamps.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,9 @@ describe('timestamps', function() {
}, { timestamps: { createdAt: 'ts.createdAt', updatedAt: 'ts.updatedAt' } });
const M = db.model('Test', schema);

M.create({ name: 'Test' }, function(error) {
M.create({ name: 'Test' }, function(error, doc) {
assert.ifError(error);
M.findOne({}, function(error, doc) {
M.findOne({ _id: doc._id }, function(error, doc) {
assert.ifError(error);
assert.ok(!doc.ts.createdAt);
assert.ok(doc.ts.updatedAt);
Expand Down
3 changes: 1 addition & 2 deletions test/types.buffer.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ const start = require('./common');
const Buffer = require('safe-buffer').Buffer;
const assert = require('assert');
const mongoose = require('./common').mongoose;
const random = require('../lib/utils').random;

const MongooseBuffer = mongoose.Types.Buffer;
const Schema = mongoose.Schema;
Expand Down Expand Up @@ -83,7 +82,7 @@ describe('types.buffer', function() {
});

t.validate(function(err) {
assert.ok(err.message.indexOf('UserBuffer validation failed') === 0, err.message);
assert.ok(err.message.indexOf('Test validation failed') === 0, err.message);
assert.equal(err.errors.required.kind, 'required');
t.required = { x: [20] };
t.save(function(err) {
Expand Down
6 changes: 3 additions & 3 deletions test/types.documentarray.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -247,10 +247,10 @@ describe('types.documentarray', function() {
});

const db = mongoose.createConnection();
let M = db.model('Test', { docs: [subSchema] });
let m = new M;
const M = db.model('Test', { docs: [subSchema] });
const m = new M;
m.docs.push({ docs: [{ title: 'hello' }] });
let delta = m.$__delta()[1];
const delta = m.$__delta()[1];
assert.equal(delta.$push.docs.$each[0].changed, undefined);

done();
Expand Down
2 changes: 1 addition & 1 deletion test/versioning.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,7 @@ describe('versioning', function() {

it('version works with strict docs', function(done) {
const schema = new Schema({ str: ['string'] }, { strict: true, collection: 'versionstrict_' + random() });
db.deleteModel(/BlogPost/)
db.deleteModel(/BlogPost/);
const M = db.model('BlogPost', schema);
const m = new M({ str: ['death', 'to', 'smootchy'] });
m.save(function(err) {
Expand Down

0 comments on commit 105c8ae

Please sign in to comment.