Skip to content

Commit

Permalink
test coverage for english fallback
Browse files Browse the repository at this point in the history
  • Loading branch information
ann-kilzer committed Jul 6, 2024
1 parent 3f966f6 commit 6139534
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions src/components/TeamMemberCard/__team__/TeamMemberCard.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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(<TeamMemberCard member={partialMember} />)

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()
})
})

0 comments on commit 6139534

Please sign in to comment.