@@ -1331,9 +1331,12 @@ describe('mongodb connector', function() {
1331
1331
function ( err , updatedusers ) {
1332
1332
should . exist ( err ) ;
1333
1333
err . name . should . equal ( 'MongoError' ) ;
1334
- err . errmsg . should . equal (
1335
- "The dollar ($) prefixed field '$rename' in '$rename' is not allowed in the context of an update's " +
1336
- 'replacement document. Consider using an aggregation pipeline with $replaceWith.' ,
1334
+ err . errmsg . should . equalOneOf (
1335
+ ( "The dollar ($) prefixed field '$rename' in '$rename' is not " +
1336
+ "allowed in the context of an update's replacement document. Consider using an " +
1337
+ 'aggregation pipeline with $replaceWith.' ) ,
1338
+ ( 'The dollar ($) prefixed ' +
1339
+ "field '$rename' in '$rename' is not valid for storage." ) ,
1337
1340
) ;
1338
1341
done ( ) ;
1339
1342
} ,
@@ -1356,9 +1359,12 @@ describe('mongodb connector', function() {
1356
1359
function ( err , updatedusers ) {
1357
1360
should . exist ( err ) ;
1358
1361
err . name . should . equal ( 'MongoError' ) ;
1359
- err . errmsg . should . equal (
1360
- "The dollar ($) prefixed field '$rename' in '$rename' is not allowed in the context of an update's " +
1361
- 'replacement document. Consider using an aggregation pipeline with $replaceWith.' ,
1362
+ err . errmsg . should . equalOneOf (
1363
+ ( "The dollar ($) prefixed field '$rename' in '$rename' is not " +
1364
+ "allowed in the context of an update's replacement document. Consider using an " +
1365
+ 'aggregation pipeline with $replaceWith.' ) ,
1366
+ ( 'The dollar ($) prefixed ' +
1367
+ "field '$rename' in '$rename' is not valid for storage." ) ,
1362
1368
) ;
1363
1369
done ( ) ;
1364
1370
} ,
@@ -1413,9 +1419,12 @@ describe('mongodb connector', function() {
1413
1419
function ( err , updatedusers ) {
1414
1420
should . exist ( err ) ;
1415
1421
err . name . should . equal ( 'MongoError' ) ;
1416
- err . errmsg . should . equal (
1417
- "The dollar ($) prefixed field '$rename' in '$rename' is not allowed in the context of an update's " +
1418
- 'replacement document. Consider using an aggregation pipeline with $replaceWith.' ,
1422
+ err . errmsg . should . equalOneOf (
1423
+ ( "The dollar ($) prefixed field '$rename' in '$rename' is not " +
1424
+ "allowed in the context of an update's replacement document. Consider using an " +
1425
+ 'aggregation pipeline with $replaceWith.' ) ,
1426
+ ( 'The dollar ($) prefixed ' +
1427
+ "field '$rename' in '$rename' is not valid for storage." ) ,
1419
1428
) ;
1420
1429
done ( ) ;
1421
1430
} ,
@@ -3430,6 +3439,24 @@ describe('mongodb connector', function() {
3430
3439
module . processMongoDBURL ( database , url ) . should . be . eql ( 'mongodb://db1.example.com:27017,db2.example.com:32667/mydb?authSource=admin&replicaSet=replset&readPreference=primary&ssl=true' ) ;
3431
3440
} ) ;
3432
3441
3442
+ it ( 'when no seetings db, lb4 url has no db, no user credentials, single host, and no options' , function ( ) {
3443
+ const url = 'loopback-connector-mongodb://localhost:27017' ;
3444
+ const database = '' ;
3445
+ module . processMongoDBURL ( database , url ) . should . be . eql ( 'loopback-connector-mongodb://localhost:27017/' ) ;
3446
+ } ) ;
3447
+
3448
+ it ( 'when no seetings db, lb4 srv url has no db, no user credentials, single host, and no options' , function ( ) {
3449
+ const url = 'loopback-connector-mongodb+srv://localhost:27017' ;
3450
+ const database = '' ;
3451
+ module . processMongoDBURL ( database , url ) . should . be . eql ( 'loopback-connector-mongodb+srv://localhost:27017/' ) ;
3452
+ } ) ;
3453
+
3454
+ it ( 'when it is not mongo url' , function ( ) {
3455
+ const url = 'http://localhost:27017' ;
3456
+ const database = '' ;
3457
+ module . processMongoDBURL ( database , url ) . should . be . eql ( 'http://localhost:27017' ) ;
3458
+ } ) ;
3459
+
3433
3460
it ( 'when no seetings db, url has no db, no user credentials, single host, and no options' , function ( ) {
3434
3461
const url = 'mongodb://localhost:27017' ;
3435
3462
const database = '' ;
0 commit comments