File tree 1 file changed +42
-0
lines changed 1 file changed +42
-0
lines changed Original file line number Diff line number Diff line change @@ -3206,4 +3206,46 @@ describe('Parse.Query testing', () => {
3206
3206
. then ( ( ) => q . find ( { useMasterKey : true } ) )
3207
3207
. then ( done . fail , done ) ;
3208
3208
} ) ;
3209
+
3210
+ it ( 'should match complex structure with dot notation when using matchesKeyInQuery' , function ( done ) {
3211
+ const group1 = new Parse . Object ( 'Group' , {
3212
+ name : 'Group #1'
3213
+ } ) ;
3214
+
3215
+ const group2 = new Parse . Object ( 'Group' , {
3216
+ name : 'Group #2'
3217
+ } ) ;
3218
+
3219
+ Parse . Object . saveAll ( [ group1 , group2 ] )
3220
+ . then ( ( ) => {
3221
+ const role1 = new Parse . Object ( 'Role' , {
3222
+ name : 'Role #1' ,
3223
+ type : 'x' ,
3224
+ belongsTo : group1
3225
+ } ) ;
3226
+
3227
+ const role2 = new Parse . Object ( 'Role' , {
3228
+ name : 'Role #2' ,
3229
+ type : 'y' ,
3230
+ belongsTo : group1
3231
+ } ) ;
3232
+
3233
+ return Parse . Object . saveAll ( [ role1 , role2 ] ) ;
3234
+ } )
3235
+ . then ( ( ) => {
3236
+ const rolesOfTypeX = new Parse . Query ( 'Role' ) ;
3237
+ rolesOfTypeX . equalTo ( 'type' , 'x' ) ;
3238
+
3239
+ const groupsWithRoleX = new Parse . Query ( 'Group' ) ;
3240
+ groupsWithRoleX . matchesKeyInQuery ( 'objectId' , 'belongsTo.objectId' , rolesOfTypeX ) ;
3241
+
3242
+ groupsWithRoleX . find ( expectSuccess ( {
3243
+ success : function ( results ) {
3244
+ equal ( results . length , 1 ) ;
3245
+ equal ( results [ 0 ] . get ( 'name' ) , group1 . get ( 'name' ) ) ;
3246
+ done ( ) ;
3247
+ }
3248
+ } ) )
3249
+ } )
3250
+ } ) ;
3209
3251
} ) ;
You can’t perform that action at this time.
0 commit comments