Extract admin dashboard from ghabilee-frontend2 into a dedicated Next.js app for backoffice.ghabilee.ir (no SEO indexing / Clarity).
29 lines
1.1 KiB
TypeScript
29 lines
1.1 KiB
TypeScript
import { describe, expect, it } from 'vitest'
|
|
|
|
import {
|
|
confirmsCurrentMobile,
|
|
confirmsFinalMobileChange,
|
|
MOBILE_CHANGE_FINAL_CONFIRMATION,
|
|
normalizeAdminMobile,
|
|
} from '@/validation/adminUserMobile'
|
|
|
|
describe('admin user mobile confirmation policy', () => {
|
|
it('normalizes supported Iranian mobile formats and localized digits', () => {
|
|
expect(normalizeAdminMobile('0912-123-1231')).toBe('989121231231')
|
|
expect(normalizeAdminMobile('+989121231231')).toBe('989121231231')
|
|
expect(normalizeAdminMobile('۰۹۱۲۱۲۳۱۲۳۱')).toBe('989121231231')
|
|
})
|
|
|
|
it('rejects invalid phone values', () => {
|
|
expect(normalizeAdminMobile('123')).toBeNull()
|
|
expect(normalizeAdminMobile('02112345678')).toBeNull()
|
|
})
|
|
|
|
it('requires both the current mobile and exact final phrase', () => {
|
|
expect(confirmsCurrentMobile('09111111111', '989111111111')).toBe(true)
|
|
expect(confirmsCurrentMobile('09121111111', '989111111111')).toBe(false)
|
|
expect(confirmsFinalMobileChange(MOBILE_CHANGE_FINAL_CONFIRMATION)).toBe(true)
|
|
expect(confirmsFinalMobileChange('تایید')).toBe(false)
|
|
})
|
|
})
|