From cbb27c2d530496bbe2262db2a387f0c4ee0f6001 Mon Sep 17 00:00:00 2001 From: Steve Larson <9larsons@gmail.com> Date: Tue, 5 Mar 2024 15:44:07 -0600 Subject: [PATCH] Fixed TZ dependency in Portal helpers test (#19804) no refs - Tests run locally (US TZ) often always failed because the dates are pushed to the en-GB locale. The test now forces the same TZ onto the compared to date. --- apps/portal/src/utils/helpers.test.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/apps/portal/src/utils/helpers.test.js b/apps/portal/src/utils/helpers.test.js index 541fd1c4fe..03c90168c7 100644 --- a/apps/portal/src/utils/helpers.test.js +++ b/apps/portal/src/utils/helpers.test.js @@ -455,7 +455,7 @@ describe('Helpers - ', () => { }); }); - describe.skip('getCompExpiry', () => { + describe('getCompExpiry', () => { let member = {}; beforeEach(() => { @@ -476,10 +476,12 @@ describe('Helpers - ', () => { }); it('returns the expiry date of a comped subscription', () => { - expect(getCompExpiry({member})).toEqual('13 Oct 2023'); + const date = new Date('2023-10-13T00:00:00.000Z'); + expect(getCompExpiry({member})).toEqual(date.toLocaleDateString('en-GB', {year: 'numeric', month: 'short', day: 'numeric'})); }); it('returns the expiry date of a comped subscription if the member has multiple subscriptions', () => { + const date = new Date('2023-10-13T00:00:00.000Z'); member.subscriptions.push({ status: 'cancelled', price: { @@ -489,7 +491,7 @@ describe('Helpers - ', () => { expiry_at: '2023-10-14T00:00:00.000Z' } }); - expect(getCompExpiry({member})).toEqual('13 Oct 2023'); + expect(getCompExpiry({member})).toEqual(date.toLocaleDateString('en-GB', {year: 'numeric', month: 'short', day: 'numeric'})); }); it('returns an empty string if the subscription has no expiry date', () => {