Skip to content

Commit 04df433

Browse files
committed
fix: unit tests
1 parent cd2d0ec commit 04df433

File tree

1 file changed

+14
-13
lines changed

1 file changed

+14
-13
lines changed

kpp/kpp_test.go

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package kpp
22

33
import (
44
"errors"
5+
"fmt"
56
"testing"
67

78
"github.com/stretchr/testify/assert"
@@ -25,20 +26,20 @@ func TestValidate(t *testing.T) {
2526
IsValid: false,
2627
},
2728
{
28-
Code: "773643301",
29+
Code: "773642301",
2930
Error: nil,
3031
IsValid: true,
3132
},
3233
{
33-
Code: "773643001",
34+
Code: "773642001",
3435
Error: nil,
3536
IsValid: true,
3637
},
3738
}
38-
for _, test := range testCases {
39+
for i, test := range testCases {
3940
isValid, err := Validate(test.Code)
40-
assert.Equal(t, isValid, test.IsValid, test.Code)
41-
assert.Equal(t, true, errors.Is(test.Error, err), test.Code)
41+
assert.Equal(t, isValid, test.IsValid, fmt.Sprintf("invalid test case %d: input: %s", i, test.Code))
42+
assert.Equal(t, true, errors.Is(test.Error, err), fmt.Sprintf("invalid test case %d: input: %s", i, test.Code))
4243
}
4344
})
4445

@@ -55,20 +56,20 @@ func TestValidate(t *testing.T) {
5556
IsValid: false,
5657
},
5758
{
58-
Code: "773643301",
59+
Code: "773642301",
5960
Error: nil,
6061
IsValid: true,
6162
},
6263
{
63-
Code: "773643001",
64+
Code: "773642001",
6465
Error: nil,
6566
IsValid: true,
6667
},
6768
}
68-
for _, test := range testCases {
69+
for i, test := range testCases {
6970
isValid, err := Validate(test.Code)
70-
assert.Equal(t, isValid, test.IsValid, test.Code)
71-
assert.Equal(t, true, errors.Is(test.Error, err), test.Code)
71+
assert.Equal(t, isValid, test.IsValid, fmt.Sprintf("invalid test case %d: input: %s", i, test.Code))
72+
assert.Equal(t, true, errors.Is(test.Error, err), fmt.Sprintf("invalid test case %d: input: %s", i, test.Code))
7273
}
7374
})
7475

@@ -85,10 +86,10 @@ func TestValidate(t *testing.T) {
8586
IsValid: true,
8687
},
8788
}
88-
for _, test := range testCases {
89+
for i, test := range testCases {
8990
isValid, err := Validate(test.Code)
90-
assert.Equal(t, isValid, test.IsValid, test.Code)
91-
assert.Equal(t, true, errors.Is(test.Error, err), test.Code)
91+
assert.Equal(t, isValid, test.IsValid, fmt.Sprintf("invalid test case %d: input: %s", i, test.Code))
92+
assert.Equal(t, true, errors.Is(test.Error, err), fmt.Sprintf("invalid test case %d: input: %s", i, test.Code))
9293
}
9394
})
9495
}

0 commit comments

Comments
 (0)