Skip to content

Commit

Permalink
test: repro #8645
Browse files Browse the repository at this point in the history
  • Loading branch information
vkarpov15 committed Mar 7, 2020
1 parent b4b61d3 commit 1271ff4
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion test/model.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5874,7 +5874,6 @@ describe('Model', function() {
let M = db.model('Test', new Schema({
name: { type: String, index: true }
}, { autoIndex: false }), coll);

let dropped = yield M.syncIndexes();
assert.deepEqual(dropped, []);

Expand Down Expand Up @@ -5979,6 +5978,23 @@ describe('Model', function() {
});
});

it('syncIndexes() allows overwriting `background` option (gh-8645)', function() {
return co(function*() {
yield db.dropDatabase();

const opts = { autoIndex: false };
let schema = new Schema({ name: String }, opts);
schema.index({ name: 1 }, { background: true });

const M = db.model('Test', schema);
yield M.syncIndexes({ background: false });

const indexes = yield M.listIndexes();
assert.deepEqual(indexes[1].key, { name: 1 });
assert.strictEqual(indexes[1].background, false);
});
});

it('using `new db.model()()` (gh-6698)', function(done) {
db.model('Test', new Schema({
name: String
Expand Down

0 comments on commit 1271ff4

Please sign in to comment.