Merge remote-tracking branch 'upstream/master'
This commit is contained in:
@@ -129,6 +129,22 @@ describe('miscellaneous', function() {
|
||||
});
|
||||
});
|
||||
|
||||
it('query without limit get default 100 records', function(done) {
|
||||
var objects = [];
|
||||
for (var i = 0; i < 150; i++) {
|
||||
objects.push(new TestObject({name: 'name' + i}));
|
||||
}
|
||||
Parse.Object.saveAll(objects).then(() => {
|
||||
return new Parse.Query(TestObject).find();
|
||||
}).then((results) => {
|
||||
expect(results.length).toEqual(100);
|
||||
done();
|
||||
}, (error) => {
|
||||
fail(error);
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
it('basic saveAll', function(done) {
|
||||
var alpha = new TestObject({ letter: 'alpha' });
|
||||
var beta = new TestObject({ letter: 'beta' });
|
||||
@@ -571,6 +587,35 @@ describe('miscellaneous', function() {
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
it('test cloud function query parameters', (done) => {
|
||||
Parse.Cloud.define('echoParams', (req, res) => {
|
||||
res.success(req.params);
|
||||
});
|
||||
var headers = {
|
||||
'Content-Type': 'application/json',
|
||||
'X-Parse-Application-Id': 'test',
|
||||
'X-Parse-Javascript-Key': 'test'
|
||||
};
|
||||
request.post({
|
||||
headers: headers,
|
||||
url: 'http://localhost:8378/1/functions/echoParams', //?option=1&other=2
|
||||
qs: {
|
||||
option: 1,
|
||||
other: 2
|
||||
},
|
||||
body: '{"foo":"bar", "other": 1}'
|
||||
}, (error, response, body) => {
|
||||
expect(error).toBe(null);
|
||||
var res = JSON.parse(body).result;
|
||||
expect(res.option).toEqual('1');
|
||||
// Make sure query string params override body params
|
||||
expect(res.other).toEqual('2');
|
||||
expect(res.foo).toEqual("bar");
|
||||
delete Parse.Cloud.Functions['echoParams'];
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
it('test cloud function parameter validation success', (done) => {
|
||||
// Register a function with validation
|
||||
|
||||
Reference in New Issue
Block a user