@@ -4575,6 +4575,71 @@ describe('Parse.Query testing', () => {
45754575 } ) ;
45764576 } ) ;
45774577
4578+ it ( 'should not throw error with undefined dot notation when using matchesKeyInQuery' , async ( ) => {
4579+ const group = new Parse . Object ( 'Group' , { name : 'Group #1' } ) ;
4580+ await group . save ( ) ;
4581+
4582+ const role1 = new Parse . Object ( 'Role' , {
4583+ name : 'Role #1' ,
4584+ type : 'x' ,
4585+ belongsTo : group ,
4586+ } ) ;
4587+
4588+ const role2 = new Parse . Object ( 'Role' , {
4589+ name : 'Role #2' ,
4590+ type : 'y' ,
4591+ belongsTo : undefined ,
4592+ } ) ;
4593+ await Parse . Object . saveAll ( [ role1 , role2 ] ) ;
4594+
4595+ const rolesOfTypeX = new Parse . Query ( 'Role' ) ;
4596+ rolesOfTypeX . equalTo ( 'type' , 'x' ) ;
4597+
4598+ const groupsWithRoleX = new Parse . Query ( 'Group' ) ;
4599+ groupsWithRoleX . matchesKeyInQuery (
4600+ 'objectId' ,
4601+ 'belongsTo.objectId' ,
4602+ rolesOfTypeX
4603+ ) ;
4604+
4605+ const results = await groupsWithRoleX . find ( ) ;
4606+ equal ( results . length , 1 ) ;
4607+ equal ( results [ 0 ] . get ( 'name' ) , group . get ( 'name' ) ) ;
4608+ } ) ;
4609+
4610+ it ( 'should not throw error with undefined dot notation when using doesNotMatchKeyInQuery' , async ( ) => {
4611+ const group1 = new Parse . Object ( 'Group' , { name : 'Group #1' } ) ;
4612+ const group2 = new Parse . Object ( 'Group' , { name : 'Group #2' } ) ;
4613+ await Parse . Object . saveAll ( [ group1 , group2 ] ) ;
4614+
4615+ const role1 = new Parse . Object ( 'Role' , {
4616+ name : 'Role #1' ,
4617+ type : 'x' ,
4618+ belongsTo : group1 ,
4619+ } ) ;
4620+
4621+ const role2 = new Parse . Object ( 'Role' , {
4622+ name : 'Role #2' ,
4623+ type : 'y' ,
4624+ belongsTo : undefined ,
4625+ } ) ;
4626+ await Parse . Object . saveAll ( [ role1 , role2 ] ) ;
4627+
4628+ const rolesOfTypeX = new Parse . Query ( 'Role' ) ;
4629+ rolesOfTypeX . equalTo ( 'type' , 'x' ) ;
4630+
4631+ const groupsWithRoleX = new Parse . Query ( 'Group' ) ;
4632+ groupsWithRoleX . doesNotMatchKeyInQuery (
4633+ 'objectId' ,
4634+ 'belongsTo.objectId' ,
4635+ rolesOfTypeX
4636+ ) ;
4637+
4638+ const results = await groupsWithRoleX . find ( ) ;
4639+ equal ( results . length , 1 ) ;
4640+ equal ( results [ 0 ] . get ( 'name' ) , group2 . get ( 'name' ) ) ;
4641+ } ) ;
4642+
45784643 it ( 'withJSON supports geoWithin.centerSphere' , done => {
45794644 const inbound = new Parse . GeoPoint ( 1.5 , 1.5 ) ;
45804645 const onbound = new Parse . GeoPoint ( 10 , 10 ) ;
0 commit comments