Treasury & Bank Transfer Management System — سامانه مدیریت خزانهداری و حوالههای بانکی
ci/windows-dual-app-lab-20261016
ci/public-windows-bridge-probe-20261017
ci/windows-dispatch-bootstrap-20261016
ci/windows-dual-app-lab-20261016
dev/v7-production-failclosed-20261021
feature/reconciliation-guard-20261013
main
phase-1-foundation
phase-1-implementation
phase-2-treasury-core
phase-3-banking-reconciliation
phase-4-operations-enterprise-ux
phase-5-hardening-release
phase-6-production-platform
phase-7-production-infrastructure-bank-golive
phase-7-sql-readonly-ux-20261015
transfer-exe-to-drive-20261006
| 1 | import test from 'node:test'; |
| 2 | import assert from 'node:assert/strict'; |
| 3 | import { createSyntheticIranianIban } from './synthetic-iban.mjs'; |
| 4 | |
| 5 | function mod97(iban) { |
| 6 | const rearranged = iban.slice(4) + iban.slice(0, 4); |
| 7 | let remainder = 0; |
| 8 | for (const ch of rearranged) { |
| 9 | const sequence = /[0-9]/.test(ch) ? ch : String(ch.charCodeAt(0) - 55); |
| 10 | for (const digit of sequence) remainder = (remainder * 10 + Number(digit)) % 97; |
| 11 | } |
| 12 | return remainder; |
| 13 | } |
| 14 | test('VM-only source and beneficiary IBANs are exactly 26 characters and checksum-valid', () => { |
| 15 | for (const seed of [1, 2]) { |
| 16 | const iban = createSyntheticIranianIban(seed); |
| 17 | assert.match(iban, /^IR[0-9]{24}$/); |
| 18 | assert.equal(iban.length, 26); |
| 19 | assert.equal(mod97(iban), 1); |
| 20 | } |
| 21 | assert.notEqual(createSyntheticIranianIban(1), createSyntheticIranianIban(2)); |
| 22 | }); |
| 23 | test('rejects fixture seeds outside the synthetic one-digit range', () => { |
| 24 | for (const value of [0, 10, -1, 1.1, NaN]) assert.throws(() => createSyntheticIranianIban(value)); |
| 25 | }); |