feat: assert with startswith and endswith for string

This commit is contained in:
debugtalk
2021-10-04 18:09:46 +08:00
parent 957b899658
commit 098c5b9c94
3 changed files with 94 additions and 0 deletions

View File

@@ -32,6 +32,28 @@ func (s *stepRequestValidation) AssertEqual(jmesPath string, expected interface{
return s
}
func (s *stepRequestValidation) AssertStartsWith(jmesPath string, expected interface{}, msg string) *stepRequestValidation {
validator := TValidator{
Check: jmesPath,
Assert: "startswith",
Expect: expected,
Message: msg,
}
s.step.Validators = append(s.step.Validators, validator)
return s
}
func (s *stepRequestValidation) AssertEndsWith(jmesPath string, expected interface{}, msg string) *stepRequestValidation {
validator := TValidator{
Check: jmesPath,
Assert: "endswith",
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,