Extract admin dashboard from ghabilee-frontend2 into a dedicated Next.js app for backoffice.ghabilee.ir (no SEO indexing / Clarity).
34 lines
824 B
TypeScript
34 lines
824 B
TypeScript
import { describe, expect, it } from 'vitest'
|
||
|
||
import { countSmsSegments } from '@/lib/smsSegments'
|
||
|
||
describe('countSmsSegments', () => {
|
||
it('counts a short Persian body as one UCS-2 segment', () => {
|
||
const text = 'رزرو شما تأیید شد'
|
||
|
||
expect(countSmsSegments(text)).toEqual({
|
||
chars: Array.from(text).length,
|
||
segments: 1,
|
||
unicode: true,
|
||
})
|
||
})
|
||
|
||
it('splits a long Persian body into 67-character segments', () => {
|
||
const body = 'ا'.repeat(71)
|
||
|
||
expect(countSmsSegments(body)).toEqual({
|
||
chars: 71,
|
||
segments: 2,
|
||
unicode: true,
|
||
})
|
||
})
|
||
|
||
it('keeps GSM-7 English within 160 characters as one segment', () => {
|
||
expect(countSmsSegments('Your booking is confirmed')).toEqual({
|
||
chars: 25,
|
||
segments: 1,
|
||
unicode: false,
|
||
})
|
||
})
|
||
})
|