@@ -6,7 +6,8 @@ const MongoClient = require('../../lib/mongo_client');
66const ObjectId = require ( '../../index' ) . ObjectId ;
77const Timestamp = require ( '../../index' ) . Timestamp ;
88const Long = require ( '../../index' ) . Long ;
9- const GET_MORE_NON_RESUMABLE_CODES = require ( '../../lib/error_codes' ) . GET_MORE_NON_RESUMABLE_CODES ;
9+ const GET_MORE_NON_RESUMABLE_CODES = require ( '../../lib/error' ) . GET_MORE_NON_RESUMABLE_CODES ;
10+ const isResumableError = require ( '../../lib/error' ) . isResumableError ;
1011
1112describe ( 'Change Stream Resume Tests' , function ( ) {
1213 const test = { } ;
@@ -126,15 +127,15 @@ describe('Change Stream Resume Tests', function() {
126127 secondGetMore : req => req . reply ( GET_MORE_RESPONSE )
127128 } ,
128129 {
129- description : `should resume on an error that says " not master" ` ,
130+ description : `should resume on an error that says ' not master' ` ,
130131 passing : true ,
131132 firstAggregate : req => req . reply ( AGGREGATE_RESPONSE ) ,
132133 secondAggregate : req => req . reply ( AGGREGATE_RESPONSE ) ,
133134 firstGetMore : req => req . reply ( { ok : 0 , errmsg : 'not master' } ) ,
134135 secondGetMore : req => req . reply ( GET_MORE_RESPONSE )
135136 } ,
136137 {
137- description : `should resume on an error that says " node is recovering" ` ,
138+ description : `should resume on an error that says ' node is recovering' ` ,
138139 passing : true ,
139140 firstAggregate : req => req . reply ( AGGREGATE_RESPONSE ) ,
140141 secondAggregate : req => req . reply ( AGGREGATE_RESPONSE ) ,
@@ -175,14 +176,17 @@ describe('Change Stream Resume Tests', function() {
175176 test . server = server ;
176177 } ) ;
177178 } ) ;
179+
178180 afterEach ( done => changeStream . close ( ( ) => client . close ( ( ) => mock . cleanup ( done ) ) ) ) ;
179181
180182 configs . forEach ( config => {
181183 it ( config . description , {
182184 metadata : { requires : { mongodb : '>=3.6.0' } } ,
183185 test : function ( ) {
184186 test . server . setMessageHandler ( makeServerHandler ( config ) ) ;
185- client = new MongoClient ( `mongodb://${ test . server . uri ( ) } ` , { socketTimeoutMS : 300 } ) ;
187+ client = new MongoClient ( `mongodb://${ test . server . uri ( ) } ` , {
188+ socketTimeoutMS : 300
189+ } ) ;
186190 return client
187191 . connect ( )
188192 . then ( client => client . db ( 'test' ) )
@@ -210,3 +214,9 @@ describe('Change Stream Resume Tests', function() {
210214 } ) ;
211215 } ) ;
212216} ) ;
217+
218+ describe ( 'Change Stream Resume Error Tests' , function ( ) {
219+ it ( 'should properly process errors that lack the `mongoErrorContextSymbol`' , function ( ) {
220+ expect ( ( ) => isResumableError ( new Error ( ) ) ) . to . not . throw ( ) ;
221+ } ) ;
222+ } ) ;
0 commit comments