Skip to content

Commit

Permalink
test: make #13052 test more explicit with debug usage
Browse files Browse the repository at this point in the history
  • Loading branch information
vkarpov15 committed Mar 6, 2023
1 parent c45f67d commit 978b49d
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions test/docs/debug.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,11 +93,20 @@ describe('debug: shell', function() {
});

it('should avoid sending null session option with document ops (gh-13052)', async function() {
mongoose.set('debug', { shell: false });
let args = [];
const m = new mongoose.Mongoose();
m.set('debug', function() {
args.push([...arguments]);
});
await m.connect(start.uri);
const schema = new Schema({ name: String });
const Test = db.model('gh_13052', schema);
const Test = m.model('gh_13052', schema);

await Test.create({ name: 'foo' });
assert.equal(false, lastLog.includes('session'));
assert.equal(args.length, 1);
assert.equal(args[0][1], 'insertOne');
assert.ok(!('session' in args[0][3]));

await m.disconnect();
});
});

0 comments on commit 978b49d

Please sign in to comment.