@@ -2296,6 +2296,7 @@ describe('store', function () {
2296
2296
} ) ;
2297
2297
2298
2298
describe ( 'fetchDocuments' , function ( ) {
2299
+ const track = createNoopTrack ( ) ;
2299
2300
let findResult : unknown [ ] = [ ] ;
2300
2301
let csfleMode = 'disabled' ;
2301
2302
let find = sinon . stub ( ) . callsFake ( ( ) => {
@@ -2323,7 +2324,7 @@ describe('store', function () {
2323
2324
} ) ;
2324
2325
2325
2326
it ( 'should call find with $bsonSize projection when mongodb version is >= 4.4, not connected to ADF and csfle is disabled' , async function ( ) {
2326
- await fetchDocuments ( dataService , '5.0.0' , false , 'test.test' , { } ) ;
2327
+ await fetchDocuments ( dataService , track , '5.0.0' , false , 'test.test' , { } ) ;
2327
2328
expect ( find ) . to . have . been . calledOnce ;
2328
2329
expect ( find . getCall ( 0 ) )
2329
2330
. to . have . nested . property ( 'args.2.projection' )
@@ -2334,6 +2335,7 @@ describe('store', function () {
2334
2335
findResult = [ { __size : new Int32 ( 42 ) , __doc : { _id : 1 } } ] ;
2335
2336
const docs = await fetchDocuments (
2336
2337
dataService ,
2338
+ track ,
2337
2339
'4.0.0' ,
2338
2340
false ,
2339
2341
'test.test' ,
@@ -2345,7 +2347,7 @@ describe('store', function () {
2345
2347
} ) ;
2346
2348
2347
2349
it ( 'should NOT call find with $bsonSize projection when mongodb version is < 4.4' , async function ( ) {
2348
- await fetchDocuments ( dataService , '4.0.0' , false , 'test.test' , { } ) ;
2350
+ await fetchDocuments ( dataService , track , '4.0.0' , false , 'test.test' , { } ) ;
2349
2351
expect ( find ) . to . have . been . calledOnce ;
2350
2352
expect ( find . getCall ( 0 ) ) . to . have . nested . property (
2351
2353
'args.2.projection' ,
@@ -2354,7 +2356,7 @@ describe('store', function () {
2354
2356
} ) ;
2355
2357
2356
2358
it ( 'should NOT call find with $bsonSize projection when connected to ADF' , async function ( ) {
2357
- await fetchDocuments ( dataService , '5.0.0' , true , 'test.test' , { } ) ;
2359
+ await fetchDocuments ( dataService , track , '5.0.0' , true , 'test.test' , { } ) ;
2358
2360
expect ( find ) . to . have . been . calledOnce ;
2359
2361
expect ( find . getCall ( 0 ) ) . to . have . nested . property (
2360
2362
'args.2.projection' ,
@@ -2364,7 +2366,7 @@ describe('store', function () {
2364
2366
2365
2367
it ( 'should NOT call find with $bsonSize projection when csfle is enabled' , async function ( ) {
2366
2368
csfleMode = 'enabled' ;
2367
- await fetchDocuments ( dataService , '5.0.0' , false , 'test.test' , { } ) ;
2369
+ await fetchDocuments ( dataService , track , '5.0.0' , false , 'test.test' , { } ) ;
2368
2370
expect ( find ) . to . have . been . calledOnce ;
2369
2371
expect ( find . getCall ( 0 ) ) . to . have . nested . property (
2370
2372
'args.2.projection' ,
@@ -2375,6 +2377,7 @@ describe('store', function () {
2375
2377
it ( 'should keep user projection when provided' , async function ( ) {
2376
2378
await fetchDocuments (
2377
2379
dataService ,
2380
+ track ,
2378
2381
'5.0.0' ,
2379
2382
false ,
2380
2383
'test.test' ,
@@ -2399,6 +2402,7 @@ describe('store', function () {
2399
2402
2400
2403
const docs = await fetchDocuments (
2401
2404
dataService ,
2405
+ track ,
2402
2406
'5.0.0' ,
2403
2407
false ,
2404
2408
'test.test' ,
@@ -2419,7 +2423,14 @@ describe('store', function () {
2419
2423
find = sinon . stub ( ) . rejects ( new TypeError ( '🤷♂️' ) ) ;
2420
2424
2421
2425
try {
2422
- await fetchDocuments ( dataService , '5.0.0' , false , 'test.test' , { } ) ;
2426
+ await fetchDocuments (
2427
+ dataService ,
2428
+ track ,
2429
+ '5.0.0' ,
2430
+ false ,
2431
+ 'test.test' ,
2432
+ { }
2433
+ ) ;
2423
2434
expect . fail ( 'Expected fetchDocuments to fail with error' ) ;
2424
2435
} catch ( err ) {
2425
2436
expect ( find ) . to . have . been . calledOnce ;
@@ -2431,7 +2442,14 @@ describe('store', function () {
2431
2442
find = sinon . stub ( ) . rejects ( new MongoServerError ( 'Nope' ) ) ;
2432
2443
2433
2444
try {
2434
- await fetchDocuments ( dataService , '3.0.0' , true , 'test.test' , { } ) ;
2445
+ await fetchDocuments (
2446
+ dataService ,
2447
+ track ,
2448
+ '3.0.0' ,
2449
+ true ,
2450
+ 'test.test' ,
2451
+ { }
2452
+ ) ;
2435
2453
expect . fail ( 'Expected fetchDocuments to fail with error' ) ;
2436
2454
} catch ( err ) {
2437
2455
expect ( find ) . to . have . been . calledOnce ;
0 commit comments