#171 - a PoC of the idea of metadata value extractors. Unit tests.
This commit is contained in:
parent
9e2e12046d
commit
99cea92322
|
@ -27,3 +27,29 @@ describe('extractor for date(dd/mm/yyyy)', () => {
|
||||||
expect(_unitTests.extractorFnForDate_ddmmyyyy(s)).toBe(out)
|
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)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
Loading…
Reference in New Issue