Skip to content

Commit d6781bb

Browse files
W-A-Jamesnbbeeken
authored andcommitted
test updates
1 parent 79b155c commit d6781bb

File tree

4 files changed

+9
-11
lines changed

4 files changed

+9
-11
lines changed

test/integration/crud/find.test.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,7 @@ describe('Find', function () {
3636
const collection = db.collection('test_find_simple');
3737
const docs = [{ a: 2 }, { b: 3 }];
3838

39-
console.log('before insert');
4039
await collection.insert(docs, configuration.writeConcernMax());
41-
console.log('after insert');
4240

4341
const insertedDocs = await collection.find().toArray();
4442
expect(insertedDocs).to.have.length(2);

test/unit/operations/find.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ describe('FindOperation', function () {
4141

4242
it('should build basic find command with filter', async () => {
4343
const findOperation = new FindOperation(undefined, namespace, filter);
44-
const stub = sinon.stub(server, 'command');
44+
const stub = sinon.stub(server, 'command').resolves({});
4545
await findOperation.execute(server, undefined);
4646
expect(stub).to.have.been.calledOnceWith(namespace, {
4747
find: namespace.collection,
@@ -54,7 +54,7 @@ describe('FindOperation', function () {
5454
oplogReplay: true
5555
};
5656
const findOperation = new FindOperation(undefined, namespace, {}, options);
57-
const stub = sinon.stub(server, 'command');
57+
const stub = sinon.stub(server, 'command').resolves({});
5858
await findOperation.execute(server, undefined);
5959
expect(stub).to.have.been.calledOnceWith(
6060
namespace,

test/unit/operations/get_more.test.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ describe('GetMoreOperation', function () {
5454
);
5555
const opts = { ...options, documentsReturnedIn: 'nextBatch', returnFieldSelector: null };
5656
const operation = new GetMoreOperation(namespace, cursorId, server, opts);
57-
const stub = sinon.stub(server, 'command').returns(Promise.resolve({}));
57+
const stub = sinon.stub(server, 'command').resolves({});
5858

5959
const expectedGetMoreCommand = {
6060
getMore: cursorId,
@@ -104,7 +104,7 @@ describe('GetMoreOperation', function () {
104104

105105
it('should build basic getMore command with cursorId and collection', async () => {
106106
const getMoreOperation = new GetMoreOperation(namespace, cursorId, server, {});
107-
const stub = sinon.stub(server, 'command');
107+
const stub = sinon.stub(server, 'command').resolves({});
108108
await getMoreOperation.execute(server, undefined);
109109
expect(stub).to.have.been.calledOnceWith(namespace, {
110110
getMore: cursorId,
@@ -117,7 +117,7 @@ describe('GetMoreOperation', function () {
117117
batchSize: 234
118118
};
119119
const getMoreOperation = new GetMoreOperation(namespace, cursorId, server, options);
120-
const stub = sinon.stub(server, 'command');
120+
const stub = sinon.stub(server, 'command').resolves({});
121121
await getMoreOperation.execute(server, undefined);
122122
expect(stub).to.have.been.calledOnceWith(
123123
namespace,
@@ -130,7 +130,7 @@ describe('GetMoreOperation', function () {
130130
maxAwaitTimeMS: 234
131131
};
132132
const getMoreOperation = new GetMoreOperation(namespace, cursorId, server, options);
133-
const stub = sinon.stub(server, 'command');
133+
const stub = sinon.stub(server, 'command').resolves({});
134134
await getMoreOperation.execute(server, undefined);
135135
expect(stub).to.have.been.calledOnceWith(
136136
namespace,
@@ -188,7 +188,7 @@ describe('GetMoreOperation', function () {
188188
maxWireVersion: serverVersion
189189
};
190190
const operation = new GetMoreOperation(namespace, cursorId, server, optionsWithComment);
191-
const stub = sinon.stub(server, 'command');
191+
const stub = sinon.stub(server, 'command').resolves({});
192192
await operation.execute(server, undefined);
193193
expect(stub).to.have.been.calledOnceWith(namespace, getMore);
194194
});
@@ -202,7 +202,7 @@ describe('GetMoreOperation', function () {
202202
new ServerDescription('a:1'),
203203
{} as any
204204
);
205-
sinon.stub(server, 'command');
205+
sinon.stub(server, 'command').resolves({});
206206

207207
it('should throw if the cursorId is undefined', async () => {
208208
const getMoreOperation = new GetMoreOperation(

test/unit/operations/kill_cursors.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ describe('class KillCursorsOperation', () => {
9191
server,
9292
options
9393
) as any;
94-
const stub = sinon.stub(server, 'command').returns(Promise.resolve({}));
94+
const stub = sinon.stub(server, 'command').resolves({});
9595
await killCursorsOperation.execute(server, undefined);
9696
expect(stub).to.have.been.calledOnceWith(namespace, {
9797
killCursors: namespace.collection,

0 commit comments

Comments
 (0)