@@ -13,15 +13,14 @@ import {
1313 type MongoClient ,
1414 MongoServerError ,
1515 ObjectId ,
16- ReturnDocument ,
17- runNodelessTests
16+ ReturnDocument
1817} from '../../mongodb_runtime-testing' ;
1918import { ensureTypeByName , type FailCommandFailPoint } from '../../tools/utils' ;
2019import { assert as test } from '../shared' ;
2120
2221const DB_NAME = 'crud_api_tests' ;
2322
24- describe ( 'CRUD API' , function ( ) {
23+ describe . only ( 'CRUD API' , function ( ) {
2524 let client : MongoClient ;
2625
2726 beforeEach ( async function ( ) {
@@ -104,13 +103,9 @@ describe('CRUD API', function () {
104103 const spy = sinon . spy ( Collection . prototype , 'find' ) ;
105104 const result = await collection . findOne ( { } ) ;
106105 expect ( result ) . to . deep . equal ( { _id : 1 } ) ;
107- if ( runNodelessTests ) {
108- ensureTypeByName ( events . at ( 0 ) , 'CommandSucceededEvent' ) ;
109- } else {
110- expect ( events . at ( 0 ) ) . to . be . instanceOf ( CommandSucceededEvent ) ;
111- expect ( spy . returnValues . at ( 0 ) ) . to . have . property ( 'closed' , true ) ;
112- expect ( spy . returnValues . at ( 0 ) ) . to . have . nested . property ( 'session.hasEnded' , true ) ;
113- }
106+ expect ( events . at ( 0 ) ) . to . be . instanceOf ( CommandSucceededEvent ) ;
107+ expect ( spy . returnValues . at ( 0 ) ) . to . have . property ( 'closed' , true ) ;
108+ expect ( spy . returnValues . at ( 0 ) ) . to . have . nested . property ( 'session.hasEnded' , true ) ;
114109 } ) ;
115110 } ) ;
116111
@@ -140,14 +135,10 @@ describe('CRUD API', function () {
140135 it ( 'the cursor for findOne is closed' , async function ( ) {
141136 const spy = sinon . spy ( Collection . prototype , 'find' ) ;
142137 const error = await collection . findOne ( { } ) . catch ( error => error ) ;
143- if ( runNodelessTests ) {
144- ensureTypeByName ( error , 'MongoServerError' ) ;
145- } else {
146- expect ( error ) . to . be . instanceOf ( MongoServerError ) ;
147- expect ( events . at ( 0 ) ) . to . be . instanceOf ( CommandFailedEvent ) ;
148- expect ( spy . returnValues . at ( 0 ) ) . to . have . property ( 'closed' , true ) ;
149- expect ( spy . returnValues . at ( 0 ) ) . to . have . nested . property ( 'session.hasEnded' , true ) ;
150- }
138+ expect ( error ) . to . be . instanceOf ( MongoServerError ) ;
139+ expect ( events . at ( 0 ) ) . to . be . instanceOf ( CommandFailedEvent ) ;
140+ expect ( spy . returnValues . at ( 0 ) ) . to . have . property ( 'closed' , true ) ;
141+ expect ( spy . returnValues . at ( 0 ) ) . to . have . nested . property ( 'session.hasEnded' , true ) ;
151142 } ) ;
152143 } ) ;
153144 } ) ;
@@ -182,13 +173,9 @@ describe('CRUD API', function () {
182173 const spy = sinon . spy ( Collection . prototype , 'aggregate' ) ;
183174 const result = await collection . countDocuments ( { } ) ;
184175 expect ( result ) . to . deep . equal ( 2 ) ;
185- if ( runNodelessTests ) {
186- ensureTypeByName ( events [ 0 ] , 'CommandSucceededEvent' ) ;
187- } else {
188- expect ( events [ 0 ] ) . to . be . instanceOf ( CommandSucceededEvent ) ;
189- expect ( spy . returnValues [ 0 ] ) . to . have . property ( 'closed' , true ) ;
190- expect ( spy . returnValues [ 0 ] ) . to . have . nested . property ( 'session.hasEnded' , true ) ;
191- }
176+ expect ( events [ 0 ] ) . to . be . instanceOf ( CommandSucceededEvent ) ;
177+ expect ( spy . returnValues [ 0 ] ) . to . have . property ( 'closed' , true ) ;
178+ expect ( spy . returnValues [ 0 ] ) . to . have . nested . property ( 'session.hasEnded' , true ) ;
192179 } ) ;
193180 } ) ;
194181
@@ -218,14 +205,10 @@ describe('CRUD API', function () {
218205 it ( 'the cursor for countDocuments is closed' , async function ( ) {
219206 const spy = sinon . spy ( Collection . prototype , 'aggregate' ) ;
220207 const error = await collection . countDocuments ( { } ) . catch ( error => error ) ;
221- if ( runNodelessTests ) {
222- ensureTypeByName ( error , 'MongoServerError' ) ;
223- } else {
224- expect ( error ) . to . be . instanceOf ( MongoServerError ) ;
225- expect ( events . at ( 0 ) ) . to . be . instanceOf ( CommandFailedEvent ) ;
226- expect ( spy . returnValues . at ( 0 ) ) . to . have . property ( 'closed' , true ) ;
227- expect ( spy . returnValues . at ( 0 ) ) . to . have . nested . property ( 'session.hasEnded' , true ) ;
228- }
208+ expect ( error ) . to . be . instanceOf ( MongoServerError ) ;
209+ expect ( events . at ( 0 ) ) . to . be . instanceOf ( CommandFailedEvent ) ;
210+ expect ( spy . returnValues . at ( 0 ) ) . to . have . property ( 'closed' , true ) ;
211+ expect ( spy . returnValues . at ( 0 ) ) . to . have . nested . property ( 'session.hasEnded' , true ) ;
229212 } ) ;
230213 } ) ;
231214 } ) ;
@@ -802,11 +785,7 @@ describe('CRUD API', function () {
802785 . bulkWrite ( ops , { ordered : false , writeConcern : { w : 1 } } )
803786 . catch ( error => error ) ;
804787
805- if ( runNodelessTests ) {
806- ensureTypeByName ( error , 'MongoBulkWriteError' ) ;
807- } else {
808- expect ( error ) . to . be . instanceOf ( MongoBulkWriteError ) ;
809- }
788+ expect ( error ) . to . be . instanceOf ( MongoBulkWriteError ) ;
810789 // 1004 because one of them is duplicate key
811790 // but since it is unordered we continued to write
812791 expect ( error ) . to . have . property ( 'insertedCount' , 1004 ) ;
0 commit comments