Skip to content

Commit 132b0d6

Browse files
Eduard Bosch BertranEduard Bosch Bertran
Eduard Bosch Bertran
authored and
Eduard Bosch Bertran
committed
feat: Add tests for containsAllStartingWith
1 parent 59a57f7 commit 132b0d6

File tree

2 files changed

+36
-1
lines changed

2 files changed

+36
-1
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
"mime": "1.3.6",
3030
"mongodb": "2.2.26",
3131
"multer": "1.3.0",
32-
"parse": "1.9.2",
32+
"parse": "eduardbosch/Parse-SDK-JS#contains-all-starting-with",
3333
"parse-server-fs-adapter": "1.0.1",
3434
"parse-server-push-adapter": "1.3.0",
3535
"parse-server-s3-adapter": "1.0.6",

spec/ParseQuery.spec.js

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -343,6 +343,41 @@ describe('Parse.Query testing', () => {
343343
});
344344
});
345345

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+
346381
var BoxedNumber = Parse.Object.extend({
347382
className: "BoxedNumber"
348383
});

0 commit comments

Comments
 (0)