@@ -343,6 +343,41 @@ describe('Parse.Query testing', () => {
343
343
} ) ;
344
344
} ) ;
345
345
346
+ it ( 'containsAllStartingWith should match all strings that starts with string' , ( done ) => {
347
+
348
+ var object = new Parse . Object ( 'Object' ) ;
349
+ object . set ( 'strings' , [ 'the' , 'brown' , 'lazy' , 'fox' , 'jumps' ] ) ;
350
+ var object2 = new Parse . Object ( 'Object' ) ;
351
+ object2 . set ( 'strings' , [ 'the' , 'brown' , 'fox' , 'jumps' ] ) ;
352
+ var object3 = new Parse . Object ( 'Object' ) ;
353
+ object3 . set ( 'strings' , [ 'over' , 'the' , 'lazy' , 'dog' ] ) ;
354
+
355
+ var objectList = [ object , object2 , object3 ] ;
356
+
357
+ Parse . Object . saveAll ( objectList ) . then ( ( ) => {
358
+ equal ( objectList . length , 3 ) ;
359
+
360
+ new Parse . Query ( 'Object' )
361
+ . containsAllStartingWith ( 'strings' , [ 'the' , 'fox' , 'lazy' ] )
362
+ . find ( )
363
+ . then ( function ( results ) {
364
+ equal ( results . length , 1 ) ;
365
+ arrayContains ( results , object ) ;
366
+
367
+ return new Parse . Query ( 'Object' )
368
+ . containsAllStartingWith ( 'strings' , [ 'the' , 'lazy' ] )
369
+ . find ( ) ;
370
+ } )
371
+ . then ( function ( results ) {
372
+ equal ( results . length , 2 ) ;
373
+ arrayContains ( results , object ) ;
374
+ arrayContains ( results , object3 ) ;
375
+
376
+ done ( ) ;
377
+ } ) ;
378
+ } ) ;
379
+ } ) ;
380
+
346
381
var BoxedNumber = Parse . Object . extend ( {
347
382
className : "BoxedNumber"
348
383
} ) ;
0 commit comments