#171 - a PoC of the idea of metadata value extractors. Unit tests.

This commit is contained in:
SebastianMC 2024-11-06 10:00:23 +01:00
parent 9e2e12046d
commit 99cea92322
1 changed files with 26 additions and 0 deletions

View File

@ -27,3 +27,29 @@ describe('extractor for date(dd/mm/yyyy)', () => {
expect(_unitTests.extractorFnForDate_ddmmyyyy(s)).toBe(out)
})
})
describe('extractor for date(mm/dd/yyyy)', () => {
const params = [
// Positive
['03/05/2019', '2019-03-05//'],
['103/05/2019', '2019-03-05//'],
['103/05/20193232', '2019-03-05//'],
['99/99/9999', '9999-99-99//'],
['00/00/0000', '0000-00-00//'],
['Created at: 03/05/2019', '2019-03-05//'],
['03/05/2019 | 22:00', '2019-03-05//'],
['Created at: 03/05/2019 | 22:00', '2019-03-05//'],
// Negative
['88-Dec-2012', undefined],
['13-JANUARY-2012', undefined],
['1 .1', undefined],
['', undefined],
['abc', undefined],
['def-abc', undefined],
['3/5/2019', undefined],
];
it.each(params)('>%s< should become %s', (s: string, out: string) => {
expect(_unitTests.extractorFnForDate_mmddyyyy(s)).toBe(out)
})
})