cosmos-sdk/schema/testing/field_test.go
Aaron Craelius e7844e640c
feat(schema): testing utilities (#20705)
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
2024-07-31 06:58:30 +00:00

27 lines
557 B
Go

package schematesting
import (
"testing"
"github.com/stretchr/testify/require"
"pgregory.net/rapid"
)
func TestField(t *testing.T) {
rapid.Check(t, func(t *rapid.T) {
field := FieldGen.Draw(t, "field")
require.NoError(t, field.Validate())
})
}
func TestFieldValue(t *testing.T) {
rapid.Check(t, checkFieldValue)
}
var checkFieldValue = func(t *rapid.T) {
field := FieldGen.Draw(t, "field")
require.NoError(t, field.Validate())
fieldValue := FieldValueGen(field).Draw(t, "fieldValue")
require.NoError(t, field.ValidateValue(fieldValue))
}