feat: add length equal

This commit is contained in:
debugtalk
2021-10-03 21:52:47 +08:00
parent cb0e450f18
commit a221afb51d
4 changed files with 71 additions and 13 deletions

View File

@@ -9,17 +9,6 @@ type stepRequestValidation struct {
step *TStep
}
func (s *stepRequestValidation) AssertEqual(jmesPath string, expected interface{}, msg string) *stepRequestValidation {
validator := TValidator{
Check: jmesPath,
Assert: "equals",
Expect: expected,
Message: msg,
}
s.step.Validators = append(s.step.Validators, validator)
return s
}
func (s *stepRequestValidation) Name() string {
return s.step.Name
}
@@ -31,3 +20,25 @@ func (s *stepRequestValidation) Type() string {
func (s *stepRequestValidation) ToStruct() *TStep {
return s.step
}
func (s *stepRequestValidation) AssertEqual(jmesPath string, expected interface{}, msg string) *stepRequestValidation {
validator := TValidator{
Check: jmesPath,
Assert: "equals",
Expect: expected,
Message: msg,
}
s.step.Validators = append(s.step.Validators, validator)
return s
}
func (s *stepRequestValidation) AssertLengthEqual(jmesPath string, expected interface{}, msg string) *stepRequestValidation {
validator := TValidator{
Check: jmesPath,
Assert: "length_equals",
Expect: expected,
Message: msg,
}
s.step.Validators = append(s.step.Validators, validator)
return s
}