From 6139534e3045134d7894d8b4c9140b425cd2677a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ann=20=E6=9D=8F=20Kilzer?= Date: Sat, 6 Jul 2024 23:42:31 +0900 Subject: [PATCH] test coverage for english fallback --- .../__team__/TeamMemberCard.test.tsx | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/components/TeamMemberCard/__team__/TeamMemberCard.test.tsx b/src/components/TeamMemberCard/__team__/TeamMemberCard.test.tsx index e699f25..7363e0e 100644 --- a/src/components/TeamMemberCard/__team__/TeamMemberCard.test.tsx +++ b/src/components/TeamMemberCard/__team__/TeamMemberCard.test.tsx @@ -42,4 +42,27 @@ describe('TeamMemberCard', () => { const image = await screen.findByRole('img') expect(image).toBeVisible() }) + + const partialMember = { + nameEN: 'Alice', + nameJA: '', + titleEN: 'Lead', + titleJA: '', + image: 'example.png', + url: 'https://example.com' + } as TeamMember + + it('should render a TeamMemberCard in Japanese and fall back to English when fields are unset', async () => { + await i18next.changeLanguage('ja') + render() + + const name = await screen.findByText(partialMember.nameEN) + expect(name).toBeVisible() + const title = await screen.findByText(partialMember.titleEN) + expect(title).toBeVisible() + const link = await screen.findByRole('link') + expect(link).toHaveAttribute('href', member.url) + const image = await screen.findByRole('img') + expect(image).toBeVisible() + }) })