Skip to content

Commit

Permalink
test: update TestCheckField test to reset FieldErrors before each tes…
Browse files Browse the repository at this point in the history
…t case
  • Loading branch information
kweeuhree committed Jan 5, 2025
1 parent 575671a commit 514959c
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions internal/validator/validator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,9 @@ func TestCheckField(t *testing.T) {

for _, entry := range tests {
t.Run(entry.name, func(t *testing.T) {
// Reset FieldErrors before each test
v.FieldErrors = nil

v.CheckField(entry.ok, entry.key, entry.msg)
if len(v.FieldErrors) != len(entry.expected) {
t.Errorf("Expected %v errors, got %v", len(entry.expected), len(v.FieldErrors))
Expand Down

0 comments on commit 514959c

Please sign in to comment.