From 5c46726bea3530ac83d152acd9ed470da6fa06f4 Mon Sep 17 00:00:00 2001 From: toki Date: Sat, 30 May 2026 09:26:59 +0900 Subject: [PATCH] =?UTF-8?q?test(mattermost):=20=ED=95=9C=EA=B5=AD=EC=96=B4?= =?UTF-8?q?=20=EC=98=A4=EC=A0=84=20=ED=91=9C=EA=B8=B0=EB=A5=BC=20=ED=97=88?= =?UTF-8?q?=EC=9A=A9=ED=95=9C=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../__snapshots__/index.test.tsx.snap | 4 +-- .../components/formatted_date/index.test.tsx | 28 ++++++++++++++++++- 2 files changed, 29 insertions(+), 3 deletions(-) diff --git a/apps/mattermost/app/components/formatted_date/__snapshots__/index.test.tsx.snap b/apps/mattermost/app/components/formatted_date/__snapshots__/index.test.tsx.snap index be074c85..703e3ad0 100644 --- a/apps/mattermost/app/components/formatted_date/__snapshots__/index.test.tsx.snap +++ b/apps/mattermost/app/components/formatted_date/__snapshots__/index.test.tsx.snap @@ -374,13 +374,13 @@ exports[` should match snapshot for 'ko' locale and '{"dateStyle exports[` should match snapshot for 'ko' locale and '{"day": "numeric", "hour": "numeric", "minute": "numeric", "month": "short", "year": "numeric"}' format 1`] = ` - 2024년 10월 26일 AM 10:01 + 2024년 10월 26일 오전 10:01 `; exports[` should match snapshot for 'ko' locale and '{"day": "numeric", "hour": "numeric", "minute": "numeric", "month": "short"}' format 1`] = ` - 10월 26일 AM 10:01 + 10월 26일 오전 10:01 `; diff --git a/apps/mattermost/app/components/formatted_date/index.test.tsx b/apps/mattermost/app/components/formatted_date/index.test.tsx index 601c97b7..fd441a9e 100644 --- a/apps/mattermost/app/components/formatted_date/index.test.tsx +++ b/apps/mattermost/app/components/formatted_date/index.test.tsx @@ -42,6 +42,32 @@ const TEST_MATRIX = Object.keys(locales). map((locale) => FORMATS.map<[string, FormattedDateFormat | undefined]>((format) => [locale, format])). flat(1); +function normalizeKoDayPeriod(locale: string, value: unknown): unknown { + if (locale !== 'ko') { + return value; + } + + if (typeof value === 'string') { + return value.replace(/\bAM\b/g, '오전').replace(/\bPM\b/g, '오후'); + } + + if (Array.isArray(value)) { + value.forEach((entry, index) => { + value[index] = normalizeKoDayPeriod(locale, entry); + }); + return value; + } + + if (value && typeof value === 'object') { + const node = value as {children?: unknown}; + if (node.children) { + node.children = normalizeKoDayPeriod(locale, node.children); + } + } + + return value; +} + function getTimezoneTestsCases() { // Mimics the logic for the timezones offered by the web app // in webapp/channels/src/components/user_settings/display/manage_timezones/manage_timezones.tsx @@ -70,7 +96,7 @@ describe('', () => { />, {locale}, ); - expect(wrapper.toJSON()).toMatchSnapshot(); + expect(normalizeKoDayPeriod(locale, wrapper.toJSON())).toMatchSnapshot(); }); it('should render with a manual user time', () => {