File tree Expand file tree Collapse file tree 2 files changed +23
-13
lines changed Expand file tree Collapse file tree 2 files changed +23
-13
lines changed Original file line number Diff line number Diff line change @@ -2312,18 +2312,28 @@ describe('Parse.Query testing', () => {
2312
2312
} ) ;
2313
2313
} ) ;
2314
2314
2315
- it ( 'include on the wrong key type' , ( done ) => {
2316
- var obj = new Parse . Object ( 'TestObject' ) ;
2317
- obj . set ( 'foo' , 'bar' ) ;
2318
- obj . save ( ) . then ( ( ) => {
2319
- var query = new Parse . Query ( 'TestObject' ) ;
2320
- query . include ( 'foo' ) ;
2321
- return query . find ( ) ;
2322
- } ) . then ( ( results ) => {
2323
- console . log ( 'results:' , results ) ;
2324
- fail ( 'Should have failed to query.' ) ;
2315
+ it_exclude_dbs ( [ 'postgres' ] ) ( 'supports include on the wrong key type (#2262)' , function ( done ) {
2316
+ let childObject = new Parse . Object ( 'TestChildObject' ) ;
2317
+ childObject . set ( 'hello' , 'world' ) ;
2318
+ childObject . save ( ) . then ( ( ) => {
2319
+ let obj = new Parse . Object ( 'TestObject' ) ;
2320
+ obj . set ( 'foo' , 'bar' ) ;
2321
+ obj . set ( 'child' , childObject ) ;
2322
+ return obj . save ( ) ;
2323
+ } ) . then ( ( ) => {
2324
+ let q = new Parse . Query ( 'TestObject' ) ;
2325
+ q . include ( 'child' ) ;
2326
+ q . include ( 'child.parent' ) ;
2327
+ q . include ( 'createdAt' ) ;
2328
+ q . include ( 'createdAt.createdAt' ) ;
2329
+ return q . find ( ) ;
2330
+ } ) . then ( ( objs ) => {
2331
+ expect ( objs . length ) . toBe ( 1 ) ;
2332
+ expect ( objs [ 0 ] . get ( 'child' ) . get ( 'hello' ) ) . toEqual ( 'world' ) ;
2333
+ expect ( objs [ 0 ] . createdAt instanceof Date ) . toBe ( true ) ;
2325
2334
done ( ) ;
2326
- } , ( error ) => {
2335
+ } , ( err ) => {
2336
+ fail ( 'should not fail' ) ;
2327
2337
done ( ) ;
2328
2338
} ) ;
2329
2339
} ) ;
Original file line number Diff line number Diff line change @@ -527,14 +527,14 @@ function findPointers(object, path) {
527
527
}
528
528
529
529
if ( typeof object !== 'object' ) {
530
- throw new Parse . Error ( Parse . Error . INVALID_QUERY , 'can only include pointer fields' ) ;
530
+ return [ ] ;
531
531
}
532
532
533
533
if ( path . length == 0 ) {
534
534
if ( object . __type == 'Pointer' ) {
535
535
return [ object ] ;
536
536
}
537
- throw new Parse . Error ( Parse . Error . INVALID_QUERY , 'can only include pointer fields' ) ;
537
+ return [ ] ;
538
538
}
539
539
540
540
var subobject = object [ path [ 0 ] ] ;
You can’t perform that action at this time.
0 commit comments