Skip to content

Commit 14ab51e

Browse files
committed
removed .bind
1 parent a055b40 commit 14ab51e

File tree

3 files changed

+14
-22
lines changed

3 files changed

+14
-22
lines changed

test/unit/operations/find.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ describe('FindOperation', function () {
4242
it('should build basic find command with filter', async () => {
4343
const findOperation = new FindOperation(undefined, namespace, filter);
4444
const stub = sinon.stub(server, 'command').yieldsRight();
45-
await findOperation.execute.bind(findOperation)(server, undefined);
45+
await findOperation.execute(server, undefined);
4646
expect(stub).to.have.been.calledOnceWith(namespace, {
4747
find: namespace.collection,
4848
filter
@@ -55,7 +55,7 @@ describe('FindOperation', function () {
5555
};
5656
const findOperation = new FindOperation(undefined, namespace, {}, options);
5757
const stub = sinon.stub(server, 'command').yieldsRight();
58-
await findOperation.execute.bind(findOperation)(server, undefined);
58+
await findOperation.execute(server, undefined);
5959
expect(stub).to.have.been.calledOnceWith(
6060
namespace,
6161
sinon.match.has('oplogReplay', options.oplogReplay)

test/unit/operations/get_more.test.ts

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

66-
await operation.execute.bind(operation)(server, undefined);
66+
await operation.execute(server, undefined);
6767
expect(stub.calledOnce).to.be.true;
6868
const call = stub.getCall(0);
6969
expect(call.args[0]).to.equal(namespace);
@@ -108,7 +108,7 @@ describe('GetMoreOperation', function () {
108108
it('should build basic getMore command with cursorId and collection', async () => {
109109
const getMoreOperation = new GetMoreOperation(namespace, cursorId, server, {});
110110
const stub = sinon.stub(server, 'command').yieldsRight();
111-
await getMoreOperation.execute.bind(getMoreOperation)(server, undefined);
111+
await getMoreOperation.execute(server, undefined);
112112
expect(stub).to.have.been.calledOnceWith(namespace, {
113113
getMore: cursorId,
114114
collection: namespace.collection
@@ -121,7 +121,7 @@ describe('GetMoreOperation', function () {
121121
};
122122
const getMoreOperation = new GetMoreOperation(namespace, cursorId, server, options);
123123
const stub = sinon.stub(server, 'command').yieldsRight();
124-
await getMoreOperation.execute.bind(getMoreOperation)(server, undefined);
124+
await getMoreOperation.execute(server, undefined);
125125
expect(stub).to.have.been.calledOnceWith(
126126
namespace,
127127
sinon.match.has('batchSize', options.batchSize)
@@ -134,7 +134,7 @@ describe('GetMoreOperation', function () {
134134
};
135135
const getMoreOperation = new GetMoreOperation(namespace, cursorId, server, options);
136136
const stub = sinon.stub(server, 'command').yieldsRight();
137-
await getMoreOperation.execute.bind(getMoreOperation)(server, undefined);
137+
await getMoreOperation.execute(server, undefined);
138138
expect(stub).to.have.been.calledOnceWith(
139139
namespace,
140140
sinon.match.has('maxTimeMS', options.maxAwaitTimeMS)
@@ -192,7 +192,7 @@ describe('GetMoreOperation', function () {
192192
};
193193
const operation = new GetMoreOperation(namespace, cursorId, server, optionsWithComment);
194194
const stub = sinon.stub(server, 'command').yieldsRight();
195-
await operation.execute.bind(operation)(server, undefined);
195+
await operation.execute(server, undefined);
196196
expect(stub).to.have.been.calledOnceWith(namespace, getMore);
197197
});
198198
}
@@ -215,9 +215,7 @@ describe('GetMoreOperation', function () {
215215
server,
216216
options
217217
);
218-
const error = await getMoreOperation.execute
219-
.bind(getMoreOperation)(server, undefined)
220-
.catch(error => error);
218+
const error = await getMoreOperation.execute(server, undefined).catch(error => error);
221219
expect(error).to.be.instanceOf(MongoRuntimeError);
222220
});
223221

@@ -228,9 +226,7 @@ describe('GetMoreOperation', function () {
228226
server,
229227
options
230228
);
231-
const error = await getMoreOperation.execute
232-
.bind(getMoreOperation)(server, undefined)
233-
.catch(error => error);
229+
const error = await getMoreOperation.execute(server, undefined).catch(error => error);
234230
expect(error).to.be.instanceOf(MongoRuntimeError);
235231
});
236232

@@ -241,9 +237,7 @@ describe('GetMoreOperation', function () {
241237
server,
242238
options
243239
);
244-
const error = await getMoreOperation.execute
245-
.bind(getMoreOperation)(server, undefined)
246-
.catch(error => error);
240+
const error = await getMoreOperation.execute(server, undefined).catch(error => error);
247241
expect(error).to.be.instanceOf(MongoRuntimeError);
248242
});
249243
});

test/unit/operations/kill_cursors.test.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,8 @@ describe('class KillCursorsOperation', () => {
6464
options
6565
) as any;
6666

67-
const error = await killCursorsOperation.execute
68-
.bind(killCursorsOperation)(differentServer, undefined)
67+
const error = await killCursorsOperation
68+
.execute(differentServer, undefined)
6969
.catch(error => error);
7070

7171
expect(error).to.be.instanceOf(MongoRuntimeError);
@@ -79,9 +79,7 @@ describe('class KillCursorsOperation', () => {
7979
options
8080
) as any;
8181

82-
const error = await killCursorsOperation.execute
83-
.bind(killCursorsOperation)(server, undefined)
84-
.catch(error => error);
82+
const error = await killCursorsOperation.execute(server, undefined).catch(error => error);
8583

8684
expect(error).to.be.instanceOf(MongoRuntimeError);
8785
});
@@ -94,7 +92,7 @@ describe('class KillCursorsOperation', () => {
9492
options
9593
) as any;
9694
const stub = sinon.stub(server, 'command').yieldsRight();
97-
await killCursorsOperation.execute.bind(killCursorsOperation)(server, undefined);
95+
await killCursorsOperation.execute(server, undefined);
9896
expect(stub).to.have.been.calledOnceWith(namespace, {
9997
killCursors: namespace.collection,
10098
cursors: [cursorId]

0 commit comments

Comments
 (0)