@@ -6,6 +6,7 @@ const databaseURI = 'mongodb://localhost:27017/parseServerMongoAdapterTestDataba
66const request = require ( '../lib/request' ) ;
77const Config = require ( '../lib/Config' ) ;
88const TestUtils = require ( '../lib/TestUtils' ) ;
9+ const Utils = require ( '../lib/Utils' ) ;
910
1011const fakeClient = {
1112 s : { options : { dbName : null } } ,
@@ -245,7 +246,7 @@ describe_only_db('mongo')('MongoStorageAdapter', () => {
245246 const mob = results [ 0 ] ;
246247 expect ( mob . array instanceof Array ) . toBe ( true ) ;
247248 expect ( typeof mob . object ) . toBe ( 'object' ) ;
248- expect ( mob . date instanceof Date ) . toBe ( true ) ;
249+ expect ( Utils . isDate ( mob . date ) ) . toBe ( true ) ;
249250 return adapter . find ( 'MyClass' , schema , { } , { } ) ;
250251 } )
251252 . then ( results => {
@@ -278,9 +279,9 @@ describe_only_db('mongo')('MongoStorageAdapter', () => {
278279 } ) . save ( ) ;
279280 const adapter = Config . get ( Parse . applicationId ) . database . adapter ;
280281 const [ object ] = await adapter . _rawFind ( 'MyClass' , { } ) ;
281- expect ( object . date instanceof Date ) . toBeTrue ( ) ;
282- expect ( object . bar . date instanceof Date ) . toBeTrue ( ) ;
283- expect ( object . foo . test . date instanceof Date ) . toBeTrue ( ) ;
282+ expect ( Utils . isDate ( object . date ) ) . toBeTrue ( ) ;
283+ expect ( Utils . isDate ( object . bar . date ) ) . toBeTrue ( ) ;
284+ expect ( Utils . isDate ( object . foo . test . date ) ) . toBeTrue ( ) ;
284285 } ) ;
285286
286287 it ( 'handles nested dates in array ' , async ( ) => {
@@ -297,13 +298,13 @@ describe_only_db('mongo')('MongoStorageAdapter', () => {
297298 } ) . save ( ) ;
298299 const adapter = Config . get ( Parse . applicationId ) . database . adapter ;
299300 const [ object ] = await adapter . _rawFind ( 'MyClass' , { } ) ;
300- expect ( object . date [ 0 ] instanceof Date ) . toBeTrue ( ) ;
301- expect ( object . bar . date [ 0 ] instanceof Date ) . toBeTrue ( ) ;
302- expect ( object . foo . test . date [ 0 ] instanceof Date ) . toBeTrue ( ) ;
301+ expect ( Utils . isDate ( object . date [ 0 ] ) ) . toBeTrue ( ) ;
302+ expect ( Utils . isDate ( object . bar . date [ 0 ] ) ) . toBeTrue ( ) ;
303+ expect ( Utils . isDate ( object . foo . test . date [ 0 ] ) ) . toBeTrue ( ) ;
303304 const obj = await new Parse . Query ( 'MyClass' ) . first ( { useMasterKey : true } ) ;
304- expect ( obj . get ( 'date' ) [ 0 ] instanceof Date ) . toBeTrue ( ) ;
305- expect ( obj . get ( 'bar' ) . date [ 0 ] instanceof Date ) . toBeTrue ( ) ;
306- expect ( obj . get ( 'foo' ) . test . date [ 0 ] instanceof Date ) . toBeTrue ( ) ;
305+ expect ( Utils . isDate ( obj . get ( 'date' ) [ 0 ] ) ) . toBeTrue ( ) ;
306+ expect ( Utils . isDate ( obj . get ( 'bar' ) . date [ 0 ] ) ) . toBeTrue ( ) ;
307+ expect ( Utils . isDate ( obj . get ( 'foo' ) . test . date [ 0 ] ) ) . toBeTrue ( ) ;
307308 } ) ;
308309
309310 it ( 'upserts with $setOnInsert' , async ( ) => {
@@ -387,7 +388,7 @@ describe_only_db('mongo')('MongoStorageAdapter', () => {
387388 const mob = results [ 0 ] ;
388389 expect ( mob . array instanceof Array ) . toBe ( true ) ;
389390 expect ( typeof mob . object ) . toBe ( 'object' ) ;
390- expect ( mob . date instanceof Date ) . toBe ( true ) ;
391+ expect ( Utils . isDate ( mob . date ) ) . toBe ( true ) ;
391392 done ( ) ;
392393 } )
393394 . catch ( error => {
0 commit comments