feat(sync): add converters from Hiboutik DTOs to Prisma inputs
This commit is contained in:
15
src/utils/date.spec.ts
Normal file
15
src/utils/date.spec.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
import { parseHiboutikDate } from './date';
|
||||
|
||||
describe('parseHiboutikDate', () => {
|
||||
it('parses a Hiboutik datetime', () => {
|
||||
expect(parseHiboutikDate('2026-06-28 17:02:55')).toEqual(new Date('2026-06-28T17:02:55'));
|
||||
});
|
||||
|
||||
it('parses a date without time', () => {
|
||||
expect(parseHiboutikDate('1990-05-12')).toEqual(new Date('1990-05-12'));
|
||||
});
|
||||
|
||||
it.each(['', '0000-00-00', '0000-00-00 00:00:00', 'not a date', null, undefined])('returns undefined for %p', (value) => {
|
||||
expect(parseHiboutikDate(value)).toBeUndefined();
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user