diff --git a/packages/core/utils/lib/__tests__/parse-type.test.js b/packages/core/utils/lib/__tests__/parse-type.test.js index 9b53d0f130..85400d9052 100644 --- a/packages/core/utils/lib/__tests__/parse-type.test.js +++ b/packages/core/utils/lib/__tests__/parse-type.test.js @@ -65,6 +65,18 @@ describe('parseType', () => { expect(() => parseType({ type: 'date', value: '2019-12-32' })).toThrow(); expect(() => parseType({ type: 'date', value: '2019-02-31' })).toThrow(); }); + + it('Throws on incorrect dates and checks the error message', () => { + expect(() => parseType({ type: 'date', value: '2019-213-23' })).toThrow( + 'Invalid format, expected an ISO compatible date' + ); + expect(() => parseType({ type: 'date', value: '-212' })).toThrow( + 'Invalid format, expected an ISO compatible date' + ); + expect(() => parseType({ type: 'date', value: '2020-02-31' })).toThrow( + 'Invalid format, expected an ISO compatible date' + ); + }); }); describe('Datetime', () => {