@@ -6,7 +6,8 @@ const MongoClient = require('../../lib/mongo_client');
6
6
const ObjectId = require ( '../../index' ) . ObjectId ;
7
7
const Timestamp = require ( '../../index' ) . Timestamp ;
8
8
const 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 ;
10
11
11
12
describe ( 'Change Stream Resume Tests' , function ( ) {
12
13
const test = { } ;
@@ -126,15 +127,15 @@ describe('Change Stream Resume Tests', function() {
126
127
secondGetMore : req => req . reply ( GET_MORE_RESPONSE )
127
128
} ,
128
129
{
129
- description : `should resume on an error that says " not master" ` ,
130
+ description : `should resume on an error that says ' not master' ` ,
130
131
passing : true ,
131
132
firstAggregate : req => req . reply ( AGGREGATE_RESPONSE ) ,
132
133
secondAggregate : req => req . reply ( AGGREGATE_RESPONSE ) ,
133
134
firstGetMore : req => req . reply ( { ok : 0 , errmsg : 'not master' } ) ,
134
135
secondGetMore : req => req . reply ( GET_MORE_RESPONSE )
135
136
} ,
136
137
{
137
- description : `should resume on an error that says " node is recovering" ` ,
138
+ description : `should resume on an error that says ' node is recovering' ` ,
138
139
passing : true ,
139
140
firstAggregate : req => req . reply ( AGGREGATE_RESPONSE ) ,
140
141
secondAggregate : req => req . reply ( AGGREGATE_RESPONSE ) ,
@@ -175,14 +176,17 @@ describe('Change Stream Resume Tests', function() {
175
176
test . server = server ;
176
177
} ) ;
177
178
} ) ;
179
+
178
180
afterEach ( done => changeStream . close ( ( ) => client . close ( ( ) => mock . cleanup ( done ) ) ) ) ;
179
181
180
182
configs . forEach ( config => {
181
183
it ( config . description , {
182
184
metadata : { requires : { mongodb : '>=3.6.0' } } ,
183
185
test : function ( ) {
184
186
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
+ } ) ;
186
190
return client
187
191
. connect ( )
188
192
. then ( client => client . db ( 'test' ) )
@@ -210,3 +214,9 @@ describe('Change Stream Resume Tests', function() {
210
214
} ) ;
211
215
} ) ;
212
216
} ) ;
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