Skip to content

Commit 20c0d4a

Browse files
author
cnorris
committed
Fix maxLimit configuration check and address spacing errors identified by lint
1 parent bf3db15 commit 20c0d4a

File tree

4 files changed

+14
-12
lines changed

4 files changed

+14
-12
lines changed

spec/index.spec.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -415,8 +415,12 @@ describe('server', () => {
415415
.then(done);
416416
})
417417

418-
it('fails if maxLimit is negative', (done) => {
418+
it('fails if maxLimit is less than or equal to 0', (done) => {
419419
reconfigureServer({ maxLimit: -100 })
420+
.catch(error => {
421+
expect(error).toEqual('Max limit must be a value greater than 0.');
422+
return reconfigureServer({ maxLimit: 0 })
423+
})
420424
.catch(error => {
421425
expect(error).toEqual('Max limit must be a value greater than 0.');
422426
done();

src/Adapters/Storage/Postgres/PostgresStorageAdapter.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1452,11 +1452,11 @@ function literalizeRegexPart(s) {
14521452
// remove all instances of \Q and \E from the remaining text & escape single quotes
14531453
return (
14541454
s.replace(/([^\\])(\\E)/, '$1')
1455-
.replace(/([^\\])(\\Q)/, '$1')
1456-
.replace(/^\\E/, '')
1457-
.replace(/^\\Q/, '')
1458-
.replace(/([^'])'/, `$1''`)
1459-
.replace(/^'([^'])/, `''$1`)
1455+
.replace(/([^\\])(\\Q)/, '$1')
1456+
.replace(/^\\E/, '')
1457+
.replace(/^\\Q/, '')
1458+
.replace(/([^'])'/, `$1''`)
1459+
.replace(/^'([^'])/, `''$1`)
14601460
);
14611461
}
14621462

src/Config.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -225,10 +225,8 @@ export class Config {
225225
}
226226

227227
static validateMaxLimit(maxLimit) {
228-
if (maxLimit) {
229-
if (maxLimit <= 0) {
230-
throw 'Max limit must be a value greater than 0.'
231-
}
228+
if (maxLimit <= 0) {
229+
throw 'Max limit must be a value greater than 0.'
232230
}
233231
}
234232

src/vendor/mongodbUrl.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -255,8 +255,8 @@ Url.prototype.parse = function(url, parseQueryString, slashesDenoteHost) {
255255
hostEnd = i;
256256
break;
257257
case 64: // '@'
258-
// At this point, either we have an explicit point where the
259-
// auth portion cannot go past, or the last @ char is the decider.
258+
// At this point, either we have an explicit point where the
259+
// auth portion cannot go past, or the last @ char is the decider.
260260
atSign = i;
261261
nonHost = -1;
262262
break;

0 commit comments

Comments
 (0)