feat(frontend): add card-to-iban interface

This commit is contained in:
2026-09-21 15:08:41 +03:30
parent ff76c69ab1
commit 3bbdae60db
11 changed files with 602 additions and 0 deletions

View File

@@ -0,0 +1,23 @@
import { describe, expect, it } from 'vitest'
import { formatCard, normalizeCard, validCard } from './card'
describe('card utilities', () => {
it('normalizes Persian and Arabic digits with common separators', () => {
expect(normalizeCard('۶۰۳۷ ٩٩۷۵-۱۲۳۴ ۵۶۷۸')).toBe('6037997512345678')
})
it('keeps unexpected characters so validation can report them', () => {
expect(normalizeCard('6037 ABC 1234')).toBe('6037ABC1234')
})
it('accepts only sixteen ASCII digits', () => {
expect(validCard('6037997512345678')).toBe(true)
expect(validCard('603799751234567')).toBe(false)
expect(validCard('603799ABC2345678')).toBe(false)
})
it('groups a normalized card for display', () => {
expect(formatCard('6037997512345678')).toBe('6037 9975 1234 5678')
})
})