Fixes in factory and registry validation tests
This commit is contained in:
@@ -179,7 +179,7 @@ test "validates numeric-only BBANs (68 countries, 64.8%)" do
|
||||
# Verify they are actually numeric
|
||||
Enum.each(numeric_ibans, fn iban ->
|
||||
{:ok, parsed} = Parser.parse(iban)
|
||||
bban = String.slice(iban, 4..-1//1
|
||||
bban = String.slice(iban, 4..-1//1)
|
||||
|
||||
assert bban =~ ~r/^\d+$/,
|
||||
"Expected numeric BBAN for #{parsed.country_code}, got: #{bban}"
|
||||
@@ -194,7 +194,7 @@ test "validates alphanumeric BBANs (31+ countries, 29.5%)" do
|
||||
|
||||
# Verify they contain letters
|
||||
Enum.each(alphanumeric_ibans, fn iban ->
|
||||
bban = String.slice(iban, 4..-1//1
|
||||
bban = String.slice(iban, 4..-1//1)
|
||||
|
||||
assert bban =~ ~r/[A-Z]/,
|
||||
"Expected alphanumeric BBAN for #{iban}, got: #{bban}"
|
||||
|
||||
@@ -4,7 +4,7 @@ defmodule IbanEx.IbanFactory do
|
||||
Supports creating valid and invalid IBANs for comprehensive testing.
|
||||
"""
|
||||
|
||||
alias IbanEx.{Iban, Country}
|
||||
alias IbanEx.Parser
|
||||
|
||||
@doc """
|
||||
Build an IBAN struct with custom attributes.
|
||||
@@ -104,7 +104,7 @@ def build_with_unsupported_country do
|
||||
# Private functions
|
||||
|
||||
defp build_from_string(iban_string) do
|
||||
case IbanEx.parse(iban_string) do
|
||||
case Parser.parse(iban_string) do
|
||||
{:ok, iban} -> iban
|
||||
{:error, _} -> raise "Invalid IBAN string: #{iban_string}"
|
||||
end
|
||||
@@ -117,7 +117,7 @@ defp build_from_attrs(attrs) do
|
||||
example_iban = get_example_iban(country_code)
|
||||
|
||||
# Parse it to get the structure
|
||||
{:ok, base_iban} = IbanEx.parse(example_iban)
|
||||
{:ok, base_iban} = Parser.parse(example_iban)
|
||||
|
||||
# Override with provided attributes
|
||||
%{
|
||||
|
||||
Reference in New Issue
Block a user