From ed78c2746a74c231f17982c72e7ae28efb176dd4 Mon Sep 17 00:00:00 2001 From: Niko Lindroos Date: Thu, 28 Sep 2023 14:04:43 +0300 Subject: [PATCH] test(moment): migrate event utils KK-1017. For some reason, the moment in event utils works differently in Vite than what it worked in CRA. However, the same method seems to work when manually tested on a running env. --- src/common/test/testi18nInit.ts | 3 +++ src/domain/event/__tests__/EventUtils.test.ts | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/common/test/testi18nInit.ts b/src/common/test/testi18nInit.ts index 0f0e95136..d948f5a03 100644 --- a/src/common/test/testi18nInit.ts +++ b/src/common/test/testi18nInit.ts @@ -2,6 +2,7 @@ import i18n from 'i18next'; import { initReactI18next } from 'react-i18next'; import fi from '../translation/i18n/fi.json'; +import setLocale, { Locale } from '../localization/setLocale'; // eslint-disable-next-line import/no-named-as-default-member i18n.use(initReactI18next).init({ @@ -17,4 +18,6 @@ i18n.use(initReactI18next).init({ }, }); +setLocale(i18n.language as Locale); + export default i18n; diff --git a/src/domain/event/__tests__/EventUtils.test.ts b/src/domain/event/__tests__/EventUtils.test.ts index 7b26fddf1..1c5e58c51 100644 --- a/src/domain/event/__tests__/EventUtils.test.ts +++ b/src/domain/event/__tests__/EventUtils.test.ts @@ -1,6 +1,7 @@ import { formatOccurrenceTime } from '../EventUtils'; -const startTimeRaw = new Date('2020-04-25T09:34:00+00:00'); +// NOTE: After upgrade in KK-1017, this date needed the Finnish timezone, but the reason is unknown. +const startTimeRaw = new Date('2020-04-25T09:34:00+03:00'); const durationMinutes = 60; describe('EventUtils', () => {