Add typed spell validation strategies
This commit is contained in:
@@ -15,7 +15,7 @@ func TestValidatorAcceptsValidJSON(t *testing.T) {
|
||||
`"value"`,
|
||||
}
|
||||
for _, payload := range tests {
|
||||
result, err := New().Validate(context.Background(), requestWithPayload(payload))
|
||||
result, err := New(Options{}).Validate(context.Background(), requestWithPayload(payload))
|
||||
if err != nil {
|
||||
t.Fatalf("Validate(%s) error = %v, want nil", payload, err)
|
||||
}
|
||||
@@ -26,7 +26,7 @@ func TestValidatorAcceptsValidJSON(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestValidatorRejectsInvalidJSON(t *testing.T) {
|
||||
result, err := New().Validate(context.Background(), requestWithPayload(`{"value":`))
|
||||
result, err := New(Options{}).Validate(context.Background(), requestWithPayload(`{"value":`))
|
||||
if err != nil {
|
||||
t.Fatalf("Validate() error = %v, want nil", err)
|
||||
}
|
||||
@@ -56,11 +56,6 @@ func TestSpecAndRegister(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func requestWithPayload(payload string) contracts.ValidationRequest {
|
||||
return contracts.ValidationRequest{
|
||||
Payload: contracts.RawPayload{
|
||||
Content: []byte(payload),
|
||||
MediaType: "application/json",
|
||||
},
|
||||
}
|
||||
func requestWithPayload(payload string) contracts.SerializedValidationRequest {
|
||||
return contracts.SerializedValidationRequest{Content: []byte(payload), MediaType: "application/json"}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user