@@ -6,6 +6,11 @@ const { MongoClient } = require('mongodb');
66const databaseURI =
77 'mongodb://localhost:27017/parseServerMongoAdapterTestDatabase' ;
88
9+ const fakeClient = {
10+ s : { options : { dbName : null } } ,
11+ db : ( ) => null ,
12+ } ;
13+
914// These tests are specific to the mongo storage adapter + mongo storage format
1015// and will eventually be moved into their own repo
1116describe_only_db ( 'mongo' ) ( 'MongoStorageAdapter' , ( ) => {
@@ -16,7 +21,7 @@ describe_only_db('mongo')('MongoStorageAdapter', () => {
1621 } ) ;
1722
1823 it ( 'auto-escapes symbols in auth information' , ( ) => {
19- spyOn ( MongoClient , 'connect' ) . and . returnValue ( Promise . resolve ( null ) ) ;
24+ spyOn ( MongoClient , 'connect' ) . and . returnValue ( Promise . resolve ( fakeClient ) ) ;
2025 new MongoStorageAdapter ( {
2126 uri :
2227 'mongodb://user!with@+ symbols:password!with@+ symbols@localhost:1234/parse' ,
@@ -28,7 +33,7 @@ describe_only_db('mongo')('MongoStorageAdapter', () => {
2833 } ) ;
2934
3035 it ( "doesn't double escape already URI-encoded information" , ( ) => {
31- spyOn ( MongoClient , 'connect' ) . and . returnValue ( Promise . resolve ( null ) ) ;
36+ spyOn ( MongoClient , 'connect' ) . and . returnValue ( Promise . resolve ( fakeClient ) ) ;
3237 new MongoStorageAdapter ( {
3338 uri :
3439 'mongodb://user!with%40%2B%20symbols:password!with%40%2B%20symbols@localhost:1234/parse' ,
@@ -41,7 +46,7 @@ describe_only_db('mongo')('MongoStorageAdapter', () => {
4146
4247 // https://github.com/parse-community/parse-server/pull/148#issuecomment-180407057
4348 it ( 'preserves replica sets' , ( ) => {
44- spyOn ( MongoClient , 'connect' ) . and . returnValue ( Promise . resolve ( null ) ) ;
49+ spyOn ( MongoClient , 'connect' ) . and . returnValue ( Promise . resolve ( fakeClient ) ) ;
4550 new MongoStorageAdapter ( {
4651 uri :
4752 'mongodb://test:[email protected] :59325,ds059315-a1.mongolab.com:59315/testDBname?replicaSet=rs-ds059415' ,
0 commit comments