import { describe, expect, it } from 'vitest' import { CreateBankAccountFormValidation, CreateWithdrawalRequestFormValidation } from '@/validation/withdrawal' describe('financial form validation', () => { it('normalizes and validates Iranian IBAN values', () => { const result = CreateBankAccountFormValidation.parse({ ownerType: 'organizer', accountHolder: 'علی رضایی', iban: 'ir12 3456 7890 1234 5678 9012 34', bankName: 'بانک', }) expect(result.iban).toBe('IR123456789012345678901234') }) it.each(['IR123', 'DE123456789012345678901234', 'IR12345678901234567890123A'])('rejects an invalid IBAN: %s', (iban) => { expect(CreateBankAccountFormValidation.safeParse({ ownerType: 'organizer', accountHolder: 'علی رضایی', iban }).success).toBe(false) }) it('accepts only positive integer withdrawal amounts', () => { expect(CreateWithdrawalRequestFormValidation.safeParse({ bankAccountId: 'bank-1', amount: '100000' }).success).toBe(true) expect(CreateWithdrawalRequestFormValidation.safeParse({ bankAccountId: 'bank-1', amount: '0' }).success).toBe(false) expect(CreateWithdrawalRequestFormValidation.safeParse({ bankAccountId: 'bank-1', amount: '12.5' }).success).toBe(false) }) })