const validateIban = require('../validateIban'); describe('IBAN validation', () => { it('should return false for invalid Spanish IBAN format', () => { let isValid = validateIban('ES00 9999 0000 9999 0000 9999', 'ES'); expect(isValid).toBeFalsy(); }); it('should return true for valid Spanish IBAN', () => { let isValid = validateIban('ES91 2100 0418 4502 0005 1332', 'ES'); expect(isValid).toBeTruthy(); }); it('should return false for invalid Spanish IBAN with incorrect length', () => { let isValid = validateIban('ES91210004184502000513', 'ES'); expect(isValid).toBeFalsy(); }); it('should return false for invalid Spanish IBAN with incorrect module97 result', () => { let isValid = validateIban('ES9121000418450200051331', 'ES'); expect(isValid).toBeFalsy(); }); it('should return true for a non-Spanish countryCode', () => { let isValid = validateIban('DE89370400440532013000', 'AT'); expect(isValid).toBeTruthy(); }); it('should return true for null IBAN', () => { let isValid = validateIban(null, 'ES'); expect(isValid).toBeTruthy(); }); it('should return false for non-string IBAN', () => { let isValid = validateIban(12345, 'ES'); expect(isValid).toBeFalsy(); }); });