Skip to content

Commit f230727

Browse files
committed
code refactor
1 parent 4e803a2 commit f230727

File tree

6 files changed

+8
-65
lines changed

6 files changed

+8
-65
lines changed

lib/polish_validators/iban.ex

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ defmodule PolishValidators.Iban do
1414
iex> PolishValidators.Iban.validate("PL61109010140000071219812874")
1515
{ :ok, "Valid" }
1616
17+
iex> PolishValidators.Iban.validate("61109010140000071219812874")
18+
{ :ok, "Valid" }
19+
1720
iex> PolishValidators.Iban.validate("PL61109010140000071219812871")
1821
{ :error, "Wrong checksum" }
1922

lib/polish_validators/regon.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ defmodule PolishValidators.Regon do
1212
"""
1313

1414
@doc """
15-
Validate regon number.
15+
Validate Regon number.
1616
1717
## Examples
1818
Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,5 @@
11
defmodule PolishValidatorsIbanTest do
22
use ExUnit.Case
3-
doctest PolishValidators
4-
5-
test "valid iban with PL prefix" do
6-
assert PolishValidators.Iban.validate("PL61109010140000071219812874") == { :ok, "Valid" }
7-
end
8-
9-
test "valid iban without PL prefix" do
10-
assert PolishValidators.Iban.validate("61109010140000071219812874") == { :ok, "Valid" }
11-
end
12-
13-
test "iban with invalid checksum" do
14-
assert PolishValidators.Iban.validate("PL61109010140000071219812871") == { :error, "Wrong checksum" }
15-
end
16-
17-
test "iban with wrong length" do
18-
assert PolishValidators.Iban.validate("PL611090101400000712198128") == { :error, "Invalid length" }
19-
end
3+
doctest PolishValidators.Iban
204
end
215

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,4 @@
11
defmodule PolishValidatorsNipTest do
22
use ExUnit.Case
3-
doctest PolishValidators
4-
5-
test "valid nip" do
6-
assert PolishValidators.Nip.validate("6597068174") == { :ok, "Valid" }
7-
end
8-
9-
test "nip with invalid checksum" do
10-
assert PolishValidators.Nip.validate("6597068172") == { :error, "Wrong checksum" }
11-
end
12-
13-
test "nip with wrong length" do
14-
assert PolishValidators.Nip.validate("2") == { :error, "Invalid length" }
15-
end
3+
doctest PolishValidators.Nip
164
end
Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,4 @@
11
defmodule PolishValidatorsPeselTest do
22
use ExUnit.Case
3-
doctest PolishValidators
4-
5-
test "valid pesel" do
6-
assert PolishValidators.Pesel.validate("44051401359") == { :ok, "Valid" }
7-
end
8-
9-
test "pesel with invalid checksum" do
10-
assert PolishValidators.Pesel.validate("44051401354") == { :error, "Wrong checksum" }
11-
end
12-
13-
test "pesel with wrong length" do
14-
assert PolishValidators.Pesel.validate("2") == { :error, "Invalid length" }
15-
end
3+
doctest PolishValidators.Pesel
164
end
Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,5 @@
11
defmodule PolishValidatorsRegonTest do
22
use ExUnit.Case
3-
doctest PolishValidators
4-
5-
test "valid regon (9 digits)" do
6-
assert PolishValidators.Regon.validate("517001918") == { :ok, "Valid" }
7-
end
8-
9-
test "valid regon (14 digits)" do
10-
assert PolishValidators.Regon.validate("87515234723651") == { :ok, "Valid" }
11-
end
12-
13-
test "regon (9 digits) with invalid checksum" do
14-
assert PolishValidators.Regon.validate("517001912") == { :error, "Wrong checksum" }
15-
end
16-
17-
test "regon (14 digits) with invalid checksum" do
18-
assert PolishValidators.Regon.validate("87515234723652") == { :error, "Wrong checksum" }
19-
end
20-
21-
test "regon with wrong length" do
22-
assert PolishValidators.Regon.validate("51700191") == { :error, "Invalid length" }
23-
end
3+
doctest PolishValidators.Regon
244
end
255

0 commit comments

Comments
 (0)