Treasury & Bank Transfer Management System — سامانه مدیریت خزانه‌داری و حواله‌های بانکی

test(windows): create exact-length valid synthetic Iranian IBAN fixtures

davoodmehraban89 committed Oct 17, 2026 at 02:04 UTC fe8decb5e8282f6255545408a048e4a8a269e296
1 file changed +9
qa/windows/synthetic-iban.mjs new
+9
@@ -0,0 +1,9 @@
1 +// Synthetic-only Iranian IBAN fixture for isolated Windows VM tests.
2 +// IR + 2 check digits + 22 BBAN digits = exactly 26 characters.
3 +export function createSyntheticIranianIban(digit) {
4 + if (!Number.isInteger(digit) || digit < 1 || digit > 9) throw Error('INVALID_FIXTURE_DIGIT');
5 + const bban = '0'.repeat(21) + String(digit);
6 + let remainder = 0;
7 + for (const ch of bban + '182700') remainder = (remainder * 10 + Number(ch)) % 97;
8 + return 'IR' + String(98 - remainder).padStart(2, '0') + bban;
9 +}