@@ -4,7 +4,7 @@ import * as sinon from 'sinon';
4
4
import {
5
5
type Callback ,
6
6
type ClientSession ,
7
- CommandOperation ,
7
+ CommandCallbackOperation ,
8
8
type CommandOperationOptions ,
9
9
type Document ,
10
10
type OperationParent ,
@@ -13,7 +13,7 @@ import {
13
13
} from '../../mongodb' ;
14
14
import { topologyWithPlaceholderClient } from '../../tools/utils' ;
15
15
16
- class ConcreteCommand < T > extends CommandOperation < T > {
16
+ class ConcreteCommand < T > extends CommandCallbackOperation < T > {
17
17
constructor ( parent ?: OperationParent , options ?: CommandOperationOptions ) {
18
18
super ( parent , options ) ;
19
19
}
@@ -49,12 +49,12 @@ describe('class CommandOperation', () => {
49
49
} ) ;
50
50
51
51
context ( 'when a server is created' , ( ) => {
52
- it ( 'calls server.commandAsync when executeCommand is invoked' , async ( ) => {
52
+ it ( 'calls executeCommand, which calls server.commandAsync, when executeCommandCallback is invoked' , async ( ) => {
53
53
const operation = new ConcreteCommand < any > ( ) ;
54
54
const serverSpy = sinon . stub ( server , 'commandAsync' ) ;
55
- const commandPromise = operation . executeCommand ( server , undefined , { ping : 1 } ) ;
56
- expect ( commandPromise ) . to . be . instanceOf ( Promise ) ;
57
- await commandPromise ;
55
+ operation . executeCommandCallback ( server , undefined , { ping : 1 } , ( err , res ) => {
56
+ err ? err : res ;
57
+ } ) ;
58
58
expect ( serverSpy ) . to . have . been . calledOnce ;
59
59
} ) ;
60
60
} ) ;
0 commit comments