Length checks added, validations added
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
defmodule IbanExTest do
|
||||
alias IbanEx.{Country, Iban, Parser}
|
||||
use ExUnit.Case, async: true
|
||||
doctest_file "README.md"
|
||||
doctest IbanEx.Country.AT
|
||||
doctest IbanEx.Country.BE
|
||||
doctest IbanEx.Country.BG
|
||||
|
||||
18
test/iban_ex_validator_test.exs
Normal file
18
test/iban_ex_validator_test.exs
Normal file
@@ -0,0 +1,18 @@
|
||||
defmodule IbanExValidatorTest do
|
||||
alias IbanEx.{Validator}
|
||||
use ExUnit.Case, async: true
|
||||
|
||||
test "check IBANs length" do
|
||||
cases = [
|
||||
{"FG2112345CC6000007", {:error, :unsupported_country_code}},
|
||||
{"UK2112345CC6000007", {:error, :unsupported_country_code}},
|
||||
{"FI2112345CC6000007", :ok},
|
||||
{"FI2112345CC6000007a", {:error, :length_to_long}},
|
||||
{"FI2112345CC600007", {:error, :length_to_short}}
|
||||
]
|
||||
|
||||
Enum.all?(cases, fn {iban, result} ->
|
||||
assert Validator.check_iban_length(iban) == result
|
||||
end)
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user