Extract admin dashboard from ghabilee-frontend2 into a dedicated Next.js app for backoffice.ghabilee.ir (no SEO indexing / Clarity).
19 lines
809 B
TypeScript
19 lines
809 B
TypeScript
import { describe, expect, it } from 'vitest'
|
|
|
|
import { format } from '@/texts/format'
|
|
|
|
describe('texts format', () => {
|
|
it('replaces placeholders with string and number values', () => {
|
|
expect(format('لینک {channel} رویداد کپی شد', { channel: 'تلگرام' })).toBe('لینک تلگرام رویداد کپی شد')
|
|
expect(format('{count} صندلی باقی مانده', { count: 3 })).toBe('3 صندلی باقی مانده')
|
|
})
|
|
|
|
it('leaves missing keys as placeholders', () => {
|
|
expect(format('سلام {name}، کد {code}', { name: 'علی' })).toBe('سلام علی، کد {code}')
|
|
})
|
|
|
|
it('replaces the same key more than once', () => {
|
|
expect(format('{x} و دوباره {x}', { x: 'آزمایش' })).toBe('آزمایش و دوباره آزمایش')
|
|
})
|
|
})
|