Provide matchers for kotest
Check an element with his validator
val validator: Validator<String> = TODO("pick your validator")
"plop" should beValidFor(validator)
Check a ValidationResult
is Valid
val validator: Validator<String> = TODO("pick your validator")
validator.validate("plop") should beValid()
Check a ValidationResult
is Invalid
val validator: Validator<String> = TODO("pick your validator")
validator.validate("plop") should beInvalid()
Check a ValidationResult
have an issue on a specific field
val validator: Validator<String> = TODO("pick your validator")
validator.validate("plop") should beInvalidOnField("length")
Check a ValidationResult
have an issue with a specific message
val validator: Validator<String> = TODO("pick your validator")
validator.validate("plop") should beInvalidWithReason("requires to be not empty")
Check a ValidationResult
have some issues with specific messages
val validator: Validator<String> = TODO("pick your validator")
validator.validate("plop") should beInvalidWithAllReasons(
"requires to be not empty",
"requires matching '^[a-z]*$'"
)
Check a ValidationResult
have an issue matching a kotest Matcher
val validator: Validator<String> = TODO("pick your validator")
validator.validate("plop") should beInvalidWithAny(beLowerCase())