From 5bd160249848903e5c75435240d16e8d5d8856ad Mon Sep 17 00:00:00 2001 From: Sam Becker Date: Thu, 29 Feb 2024 16:54:15 -0600 Subject: [PATCH] Refine date tests --- __tests__/date.test.ts | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/__tests__/date.test.ts b/__tests__/date.test.ts index f113c9b9..6257779e 100644 --- a/__tests__/date.test.ts +++ b/__tests__/date.test.ts @@ -30,16 +30,18 @@ describe('Date utility', () => { .toBe('2023-12-02 16:38:36'); }); }); - it('Empty string', () => { - const timestamp = ' '; - const offset = undefined; - expect(convertTimestampWithOffsetToPostgresString( - timestamp, - offset - )) + it('Malformed date string', () => { + const timestamp = '2024/01a/01 Z'; + expect(convertTimestampWithOffsetToPostgresString(timestamp)) + .toBe(convertTimestampWithOffsetToPostgresString( + new Date().toISOString(), + )); + }); + it('Empty string', () => { + const timestamp = ' '; + expect(convertTimestampWithOffsetToPostgresString(timestamp)) .toBe(convertTimestampWithOffsetToPostgresString( new Date().toISOString(), - offset )); }); });