From dd60bc585003bac9577a29095b861bec1ab0e649 Mon Sep 17 00:00:00 2001 From: ko_oler <kooler89@gmail.com> Date: Fri, 29 Sep 2023 15:28:22 +0300 Subject: [PATCH] =?UTF-8?q?=D0=BF=D1=80=D0=B0=D0=B2=D0=BA=D0=B8=20=D0=BF?= =?UTF-8?q?=D0=BE=20=D0=9F=D0=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pkg/schema/validate/string_test.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pkg/schema/validate/string_test.go b/pkg/schema/validate/string_test.go index d50edada..9d48cf4d 100644 --- a/pkg/schema/validate/string_test.go +++ b/pkg/schema/validate/string_test.go @@ -93,11 +93,14 @@ func TestString(t *testing.T) { }{ {"Length Max", field.String().AddOptions(MaxLength(5)), "1234567", true}, {"Length Max with <nil>", field.String().AddOptions(MaxLength(5)), nil, false}, + {"Length Max and Required with <nil>", field.String().AddOptions(MaxLength(5), Required()), nil, true}, {"Length Min", field.String().AddOptions(MinLength(10)), "1234", true}, {"Length Min with <nil>", field.String().AddOptions(MinLength(10)), nil, false}, + {"Length Min and Required with <nil>", field.String().AddOptions(MinLength(10), Required()), nil, true}, {"Length MinMax", field.String().AddOptions(MaxLength(6), MinLength(2)), "1234567", true}, {"Length MinMax", field.String().AddOptions(MaxLength(10), MinLength(7)), "123456", true}, {"Length MinMax with <nil>", field.String().AddOptions(MaxLength(10), MinLength(7)), nil, false}, + {"Length MinMax and Required with <nil>", field.String().AddOptions(MaxLength(10), MinLength(7), Required()), nil, true}, {"Enum miss", field.String().AddOptions(Enum(EnumOpt{Name: "N 1", Value: "n1"}, EnumOpt{Name: "N 2", Value: "n2"})), "n3", true}, {"Enum match", field.String().AddOptions(Enum(EnumOpt{Name: "N 1", Value: "n1"}, EnumOpt{Name: "N 2", Value: "n2"})), "n2", false}, {"Invalid Schema Options", field.String().AddOptions(Schema()), invalidOptionsSchema, true}, -- GitLab