Skip to content

Commit

Permalink
chore: comments
Browse files Browse the repository at this point in the history
  • Loading branch information
durran committed Oct 14, 2024
1 parent cc5684f commit 0ff0c4f
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions test/integration/crud/crud.prose.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1113,7 +1113,7 @@ describe('CRUD Prose Spec Tests', () => {
let maxBsonObjectSize;
let maxMessageSizeBytes;
let numModels;
const models: AnyClientBulkWriteModel[] = [];
let models: AnyClientBulkWriteModel[] = [];
const commands: CommandStartedEvent[] = [];

beforeEach(async function () {
Expand All @@ -1122,20 +1122,24 @@ describe('CRUD Prose Spec Tests', () => {
});
client = this.configuration.newClient(uri, { monitorCommands: true });
await client.connect();
await client.db('db').collection('coll').drop();
await client
.db('db')
.collection('coll')
.drop()
.catch(() => null);
await client.db('db').createCollection('coll');
const hello = await client.db('admin').command({ hello: 1 });
maxBsonObjectSize = hello.maxBsonObjectSize;
maxMessageSizeBytes = hello.maxMessageSizeBytes;
numModels = Math.floor(maxMessageSizeBytes / maxBsonObjectSize) + 1;
Array.from({ length: numModels }, () => {
models.push({
models = Array.from({ length: numModels }, () => {
return {
name: 'insertOne',
namespace: 'db.coll',
document: {
a: 'b'.repeat(maxBsonObjectSize - 500)
}
});
};
});

client.on('commandStarted', filterForCommands('bulkWrite', commands));
Expand All @@ -1157,7 +1161,7 @@ describe('CRUD Prose Spec Tests', () => {
expect(commands[1].command.ops.length).to.equal(1);
expect(commands[1].command.writeConcern.w).to.equal(0);
const count = await client.db('db').collection('coll').countDocuments();
expect(count).to.equal(3);
expect(count).to.equal(numModels);
}
});
});
Expand Down

0 comments on commit 0ff0c4f

Please sign in to comment.