@@ -7,6 +7,12 @@ import (
77 "github.com/stretchr/testify/assert"
88)
99
10+ type TestCodeCase struct {
11+ Code string
12+ IsValid bool
13+ Error error
14+ }
15+
1016func TestValidateBIK (t * testing.T ) {
1117 t .Parallel ()
1218
@@ -15,34 +21,28 @@ func TestValidateBIK(t *testing.T) {
1521 })
1622}
1723
18- type TestINNCase struct {
19- INN string
20- IsValid bool
21- Error error
22- }
23-
2424func TestValidateINN (t * testing.T ) {
2525 t .Parallel ()
2626
2727 t .Run ("invalid inn length" , func (t * testing.T ) {
28- testCases := []TestINNCase {
29- TestINNCase {
30- INN : "12345678" ,
28+ testCases := []TestCodeCase {
29+ TestCodeCase {
30+ Code : "12345678" ,
3131 Error : errInvalidINNLength ,
3232 IsValid : false ,
3333 },
34- TestINNCase {
35- INN : "9876543211123" ,
34+ TestCodeCase {
35+ Code : "9876543211123" ,
3636 Error : errInvalidINNLength ,
3737 IsValid : false ,
3838 },
39- TestINNCase {
40- INN : "7707083893" ,
39+ TestCodeCase {
40+ Code : "7707083893" ,
4141 Error : nil ,
4242 IsValid : true ,
4343 },
44- TestINNCase {
45- INN : "526317984689" ,
44+ TestCodeCase {
45+ Code : "526317984689" ,
4646 Error : nil ,
4747 IsValid : true ,
4848 },
@@ -55,35 +55,35 @@ func TestValidateINN(t *testing.T) {
5555 })
5656
5757 t .Run ("invalid inn value" , func (t * testing.T ) {
58- testCases := []TestINNCase {
59- TestINNCase {
60- INN : "77$7083893" ,
58+ testCases := []TestCodeCase {
59+ TestCodeCase {
60+ Code : "77$7083893" ,
6161 Error : errInvalidValue ,
6262 IsValid : false ,
6363 },
64- TestINNCase {
65- INN : "98754321N123" ,
64+ TestCodeCase {
65+ Code : "98754321N123" ,
6666 Error : errInvalidValue ,
6767 IsValid : false ,
6868 },
69- TestINNCase {
70- INN : "9854132d1123" ,
69+ TestCodeCase {
70+ Code : "9854132d1123" ,
7171 Error : errInvalidValue ,
7272 IsValid : false ,
7373 },
74- TestINNCase {
75- INN : "7707083893" ,
74+ TestCodeCase {
75+ Code : "7707083893" ,
7676 Error : nil ,
7777 IsValid : true ,
7878 },
79- TestINNCase {
80- INN : "526317984689" ,
79+ TestCodeCase {
80+ Code : "526317984689" ,
8181 Error : nil ,
8282 IsValid : true ,
8383 },
8484 }
8585 for _ , test := range testCases {
86- isValid , err := ValidateINN (test .INN )
86+ isValid , err := ValidateINN (test .Code )
8787 assert .Equal (t , isValid , test .IsValid )
8888 assert .Equal (t , errors .Is (test .Error , err ), true )
8989 }
0 commit comments