Addressed PR comments to check throw messages

This commit is contained in:
Changhao 2022-05-18 10:01:31 -07:00
parent 4220909c81
commit f8c0cd7052

View File

@ -60,10 +60,18 @@ describe('parseType', () => {
});
it('Throws on invalid formator dates', () => {
expect(() => parseType({ type: 'date', value: '-1029-11-02' })).toThrow();
expect(() => parseType({ type: 'date', value: '2019-13-02' })).toThrow();
expect(() => parseType({ type: 'date', value: '2019-12-32' })).toThrow();
expect(() => parseType({ type: 'date', value: '2019-02-31' })).toThrow();
expect(() => parseType({ type: 'date', value: '-1029-11-02' })).toThrow(
'Invalid format, expected an ISO compatible date'
);
expect(() => parseType({ type: 'date', value: '2019-13-02' })).toThrow(
'Invalid format, expected an ISO compatible date'
);
expect(() => parseType({ type: 'date', value: '2019-12-32' })).toThrow(
'Invalid format, expected an ISO compatible date'
);
expect(() => parseType({ type: 'date', value: '2019-02-31' })).toThrow(
'Invalid format, expected an ISO compatible date'
);
});
it('Throws on incorrect dates and checks the error message', () => {