Skip to content

Commit

Permalink
Add MaxLengthConstraints check
Browse files Browse the repository at this point in the history
  • Loading branch information
hwchiu committed Oct 3, 2017
1 parent d02b4b0 commit a4aa6fe
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion schema/string_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ func TestDecodeString_ErrorCheckingConstraints(t *testing.T) {
{"InvalidMinLength_UUID", "6fa459ea-ee8a-3ca4-894e-db77e160355e", stringUUID, Constraints{MinLength: 100}},
{"InvalidMinLength_Email", "foo@bar.com", stringEmail, Constraints{MinLength: 100}},
{"InvalidMinLength_URI", "http://google.com", stringURI, Constraints{MinLength: 100}},
{"InvalidMaxLength_UUID", "6fa459ea-ee8a-3ca4-894e-db77e160355e", stringUUID, Constraints{MaxLength: 1}},
{"InvalidMaxLength_Email", "foo@bar.com", stringEmail, Constraints{MaxLength: 1}},
{"InvalidMaxLength_URI", "http://google.com", stringURI, Constraints{MaxLength: 1}},
}
for _, d := range data {
t.Run(d.desc, func(t *testing.T) {
Expand All @@ -45,7 +48,7 @@ func TestDecodeString_Success(t *testing.T) {
}{
{"URI", "http://google.com", stringURI, Constraints{MinLength: 1}},
{"Email", "foo@bar.com", stringEmail, Constraints{MinLength: 1}},
{"UUID", "C56A4180-65AA-42EC-A945-5FD21DEC0538", stringUUID, Constraints{MinLength: 1}},
{"UUID", "C56A4180-65AA-42EC-A945-5FD21DEC0538", stringUUID, Constraints{MinLength: 36, MaxLength: 36}},
}
for _, d := range data {
t.Run(d.desc, func(t *testing.T) {
Expand Down

0 comments on commit a4aa6fe

Please sign in to comment.