From 3722c91e52ed3f29ac2ff7fab671bde056cfab7f Mon Sep 17 00:00:00 2001 From: Will Kencel Date: Sat, 21 Dec 2024 16:40:17 -0800 Subject: [PATCH] added testng for tick date formatting change --- src/__tests__/ticks.ts | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/__tests__/ticks.ts b/src/__tests__/ticks.ts index 33ab8f2..3370733 100644 --- a/src/__tests__/ticks.ts +++ b/src/__tests__/ticks.ts @@ -204,7 +204,7 @@ describe('ticks API', () => { name: 'Updated Route One', climbId: 'new climb id', userId: userUuid, - dateClimbed: '2022-11-10', + dateClimbed: new Date('2022-11-10T12:00:00Z'), grade: 'new grade', source: 'OB' } @@ -218,5 +218,21 @@ describe('ticks API', () => { expect(updateResponse.statusCode).toBe(200) expect(updateResponse.body.data.tick.name).toBe('Updated Route One') }) + it('verifies date formats correctly', async () => { + const validDateTick = { + ...tickOne, + dateClimbed: new Date('2022-11-10T15:30:00Z').getTime() + } + const validResponse = await queryAPI({ + query: createQuery, + variables: { input: validDateTick }, + userUuid, + roles: ['user_admin'], + app + }) + expect(validResponse.statusCode).toBe(200) + expect(validResponse.body.data.tick.dateClimbed) + .toBe(new Date('2022-11-10T15:30:00Z').getTime()) + }) }) })