30 lines
949 B
Go
30 lines
949 B
Go
package releasekit
|
|
|
|
import (
|
|
"errors"
|
|
"testing"
|
|
|
|
"gitea.maximumdirect.net/eric/ReleaseKit/internal/validation"
|
|
)
|
|
|
|
func TestCandidateRequestMapsGoValidation(t *testing.T) {
|
|
request := candidateRequest(ReleaseRequest{
|
|
Validation: ValidationSpec{Go: GoValidationSpec{Race: true, FullVet: true}},
|
|
})
|
|
if !request.Validation.Race || !request.Validation.FullVet {
|
|
t.Fatalf("candidate request validation = %#v, want race and full vet enabled", request.Validation)
|
|
}
|
|
}
|
|
|
|
func TestValidationErrorPreservesGoVetIdentity(t *testing.T) {
|
|
cause := errors.New("vet failed")
|
|
got := convertValidationError(&validation.Failure{Check: validation.GoVet, Cause: cause})
|
|
var validationError *ValidationError
|
|
if !errors.As(got, &validationError) || validationError.Check != "go-vet" {
|
|
t.Fatalf("converted error = %#v, want go-vet validation identity", got)
|
|
}
|
|
if !errors.Is(got, cause) {
|
|
t.Fatalf("converted error = %v, want cause preserved", got)
|
|
}
|
|
}
|