Skip to content

Commit

Permalink
Added test for StringLenBetween
Browse files Browse the repository at this point in the history
  • Loading branch information
yutachaos committed Nov 28, 2024
1 parent 66c769d commit 983a61a
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions helper/validation/strings_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,25 @@ func TestValidationStringIsWhiteSpace(t *testing.T) {
}
}

func TestValidationStringLenBetween(t *testing.T) {
runTestCases(t, []testCase{
{
val: "abc",
f: StringLenBetween(1, 5),
},
{
val: "InvalidValue",
f: StringLenBetween(1, 5),
expectedErr: regexp.MustCompile(`expected length of [\w]+ to be in the range \(1 \- 5\), got InvalidValue`),
},
{
val: 1,
f: StringLenBetween(1, 5),
expectedErr: regexp.MustCompile(`expected type of [\w]+ to be string`),
},
})
}

func TestValidationStringIsBase64(t *testing.T) {
cases := map[string]struct {
Value interface{}
Expand Down

0 comments on commit 983a61a

Please sign in to comment.