mirror of
https://github.com/strapi/strapi.git
synced 2025-11-07 21:58:23 +00:00
Added test case to check the thrown error message if input is incorrect date
This commit is contained in:
parent
e58b983b6f
commit
ef8ead4ddb
@ -65,6 +65,18 @@ describe('parseType', () => {
|
|||||||
expect(() => parseType({ type: 'date', value: '2019-12-32' })).toThrow();
|
expect(() => parseType({ type: 'date', value: '2019-12-32' })).toThrow();
|
||||||
expect(() => parseType({ type: 'date', value: '2019-02-31' })).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', () => {
|
describe('Datetime', () => {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user