Files
carmanagement/dashboard/src/components/ui/BilingualInput.test.ts
T
root d7fb7b7a7b
Build & Deploy / Build & Push Docker Image (push) Failing after 47s
Build & Deploy / Deploy to VPS (push) Has been skipped
Test / API Unit Tests (push) Failing after 5m4s
Test / Marketplace Unit Tests (push) Failing after 4m55s
Test / Admin Unit Tests (push) Successful in 9m37s
Test / Dashboard Unit Tests (push) Successful in 9m37s
Test / API Integration Tests (push) Successful in 9m54s
redesign the homepage
2026-06-26 16:27:21 -04:00

23 lines
964 B
TypeScript

import { describe, expect, it } from 'vitest'
import { bilingualPrimary, emptyBilingual } from './BilingualInput'
describe('bilingual field helpers', () => {
it('returns a stable empty field shape for French and Arabic labels', () => {
expect(emptyBilingual()).toEqual({ fr: '', ar: '' })
expect(emptyBilingual()).not.toBe(emptyBilingual())
})
it('prefers French as the primary display value when both translations exist', () => {
expect(bilingualPrimary({ fr: 'Assurance', ar: 'تأمين' })).toBe('Assurance')
})
it('falls back to Arabic when the French value is empty', () => {
expect(bilingualPrimary({ fr: '', ar: 'تأمين' })).toBe('تأمين')
})
it('does not trim values implicitly so form state remains lossless', () => {
expect(bilingualPrimary({ fr: ' Service premium ', ar: 'خدمة' })).toBe(' Service premium ')
expect(bilingualPrimary({ fr: '', ar: ' خدمة ' })).toBe(' خدمة ')
})
})