Skip to content

Commit 9512a72

Browse files
committed
changed execute to executeCallback in tests
1 parent 3f802d9 commit 9512a72

File tree

3 files changed

+21
-20
lines changed

3 files changed

+21
-20
lines changed

test/unit/operations/find.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ describe('FindOperation', function () {
4343
it('should build basic find command with filter', async () => {
4444
const findOperation = new FindOperation(undefined, namespace, filter);
4545
const stub = sinon.stub(server, 'command').yieldsRight();
46-
await promisify(findOperation.execute.bind(findOperation))(server, undefined);
46+
await promisify(findOperation.executeCallback.bind(findOperation))(server, undefined);
4747
expect(stub).to.have.been.calledOnceWith(namespace, {
4848
find: namespace.collection,
4949
filter
@@ -56,7 +56,7 @@ describe('FindOperation', function () {
5656
};
5757
const findOperation = new FindOperation(undefined, namespace, {}, options);
5858
const stub = sinon.stub(server, 'command').yieldsRight();
59-
await promisify(findOperation.execute.bind(findOperation))(server, undefined);
59+
await promisify(findOperation.executeCallback.bind(findOperation))(server, undefined);
6060
expect(stub).to.have.been.calledOnceWith(
6161
namespace,
6262
sinon.match.has('oplogReplay', options.oplogReplay)

test/unit/operations/get_more.test.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ describe('GetMoreOperation', function () {
6464
maxTimeMS: 500
6565
};
6666

67-
await promisify(operation.execute.bind(operation))(server, undefined);
67+
await promisify(operation.executeCallback.bind(operation))(server, undefined);
6868
expect(stub.calledOnce).to.be.true;
6969
const call = stub.getCall(0);
7070
expect(call.args[0]).to.equal(namespace);
@@ -93,7 +93,7 @@ describe('GetMoreOperation', function () {
9393
expect(error.message).to.equal('Getmore must run on the same server operation began on');
9494
done();
9595
};
96-
operation.execute(server2, session, callback);
96+
operation.executeCallback(server2, session, callback);
9797
});
9898
});
9999

@@ -109,7 +109,7 @@ describe('GetMoreOperation', function () {
109109
it('should build basic getMore command with cursorId and collection', async () => {
110110
const getMoreOperation = new GetMoreOperation(namespace, cursorId, server, {});
111111
const stub = sinon.stub(server, 'command').yieldsRight();
112-
await promisify(getMoreOperation.execute.bind(getMoreOperation))(server, undefined);
112+
await promisify(getMoreOperation.executeCallback.bind(getMoreOperation))(server, undefined);
113113
expect(stub).to.have.been.calledOnceWith(namespace, {
114114
getMore: cursorId,
115115
collection: namespace.collection
@@ -122,7 +122,7 @@ describe('GetMoreOperation', function () {
122122
};
123123
const getMoreOperation = new GetMoreOperation(namespace, cursorId, server, options);
124124
const stub = sinon.stub(server, 'command').yieldsRight();
125-
await promisify(getMoreOperation.execute.bind(getMoreOperation))(server, undefined);
125+
await promisify(getMoreOperation.executeCallback.bind(getMoreOperation))(server, undefined);
126126
expect(stub).to.have.been.calledOnceWith(
127127
namespace,
128128
sinon.match.has('batchSize', options.batchSize)
@@ -135,7 +135,7 @@ describe('GetMoreOperation', function () {
135135
};
136136
const getMoreOperation = new GetMoreOperation(namespace, cursorId, server, options);
137137
const stub = sinon.stub(server, 'command').yieldsRight();
138-
await promisify(getMoreOperation.execute.bind(getMoreOperation))(server, undefined);
138+
await promisify(getMoreOperation.executeCallback.bind(getMoreOperation))(server, undefined);
139139
expect(stub).to.have.been.calledOnceWith(
140140
namespace,
141141
sinon.match.has('maxTimeMS', options.maxAwaitTimeMS)
@@ -193,7 +193,7 @@ describe('GetMoreOperation', function () {
193193
};
194194
const operation = new GetMoreOperation(namespace, cursorId, server, optionsWithComment);
195195
const stub = sinon.stub(server, 'command').yieldsRight();
196-
await promisify(operation.execute.bind(operation))(server, undefined);
196+
await promisify(operation.executeCallback.bind(operation))(server, undefined);
197197
expect(stub).to.have.been.calledOnceWith(namespace, getMore);
198198
});
199199
}
@@ -216,7 +216,7 @@ describe('GetMoreOperation', function () {
216216
server,
217217
options
218218
);
219-
const error = await promisify(getMoreOperation.execute.bind(getMoreOperation))(
219+
const error = await promisify(getMoreOperation.executeCallback.bind(getMoreOperation))(
220220
server,
221221
undefined
222222
).catch(error => error);
@@ -230,7 +230,7 @@ describe('GetMoreOperation', function () {
230230
server,
231231
options
232232
);
233-
const error = await promisify(getMoreOperation.execute.bind(getMoreOperation))(
233+
const error = await promisify(getMoreOperation.executeCallback.bind(getMoreOperation))(
234234
server,
235235
undefined
236236
).catch(error => error);
@@ -244,7 +244,7 @@ describe('GetMoreOperation', function () {
244244
server,
245245
options
246246
);
247-
const error = await promisify(getMoreOperation.execute.bind(getMoreOperation))(
247+
const error = await promisify(getMoreOperation.executeCallback.bind(getMoreOperation))(
248248
server,
249249
undefined
250250
).catch(error => error);

test/unit/operations/kill_cursors.test.ts

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,9 @@ describe('class KillCursorsOperation', () => {
6565
options
6666
) as any;
6767

68-
const error = await promisify(killCursorsOperation.execute.bind(killCursorsOperation))(
69-
differentServer,
70-
undefined
71-
).catch(error => error);
68+
const error = await promisify(
69+
killCursorsOperation.executeCallback.bind(killCursorsOperation)
70+
)(differentServer, undefined).catch(error => error);
7271

7372
expect(error).to.be.instanceOf(MongoRuntimeError);
7473
});
@@ -81,10 +80,9 @@ describe('class KillCursorsOperation', () => {
8180
options
8281
) as any;
8382

84-
const error = await promisify(killCursorsOperation.execute.bind(killCursorsOperation))(
85-
server,
86-
undefined
87-
).catch(error => error);
83+
const error = await promisify(
84+
killCursorsOperation.executeCallback.bind(killCursorsOperation)
85+
)(server, undefined).catch(error => error);
8886

8987
expect(error).to.be.instanceOf(MongoRuntimeError);
9088
});
@@ -97,7 +95,10 @@ describe('class KillCursorsOperation', () => {
9795
options
9896
) as any;
9997
const stub = sinon.stub(server, 'command').yieldsRight();
100-
await promisify(killCursorsOperation.execute.bind(killCursorsOperation))(server, undefined);
98+
await promisify(killCursorsOperation.executeCallback.bind(killCursorsOperation))(
99+
server,
100+
undefined
101+
);
101102
expect(stub).to.have.been.calledOnceWith(namespace, {
102103
killCursors: namespace.collection,
103104
cursors: [cursorId]

0 commit comments

Comments
 (0)