feat: add option to change the default value of the Parse.Query.limit() constraint (#8152)

This commit is contained in:
vzukanov
2022-09-30 01:38:57 +03:00
committed by GitHub
parent b96a4cbdc5
commit 0388956808
10 changed files with 90 additions and 27 deletions

View File

@@ -462,6 +462,26 @@ describe('server', () => {
.then(done);
});
it('fails if default limit is negative', async () => {
await expectAsync(reconfigureServer({ defaultLimit: -1 })).toBeRejectedWith(
'Default limit must be a value greater than 0.'
);
});
it('fails if default limit is wrong type', async () => {
for (const value of ["invalid", {}, [], true]) {
await expectAsync(reconfigureServer({ defaultLimit: value})).toBeRejectedWith(
'Default limit must be a number.'
);
}
});
it('fails if default limit is zero', async () => {
await expectAsync(reconfigureServer({ defaultLimit: 0 })).toBeRejectedWith(
'Default limit must be a value greater than 0.'
);
});
it('fails if maxLimit is negative', done => {
reconfigureServer({ maxLimit: -100 }).catch(error => {
expect(error).toEqual('Max limit must be a value greater than 0.');