fix: Parse Server option maxLogFiles doesn't recognize day duration literals such as 1d to mean 1 day (#9215)

This commit is contained in:
Diamond Lewis
2024-07-18 08:41:59 -05:00
committed by GitHub
parent 901cff5edd
commit 0319cee2db
4 changed files with 27 additions and 1 deletions

View File

@@ -1,6 +1,7 @@
const {
numberParser,
numberOrBoolParser,
numberOrStringParser,
booleanParser,
objectParser,
arrayParser,
@@ -18,6 +19,15 @@ describe('parsers', () => {
}).toThrow();
});
it('parses correctly with numberOrStringParser', () => {
const parser = numberOrStringParser('key');
expect(parser('100d')).toEqual('100d');
expect(parser(100)).toEqual(100);
expect(() => {
parser(undefined);
}).toThrow();
});
it('parses correctly with numberOrBoolParser', () => {
const parser = numberOrBoolParser('key');
expect(parser(true)).toEqual(true);