fix: test coverage
This commit is contained in:
@@ -4,6 +4,7 @@ import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"testing"
|
||||
"net/http"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"gopkg.in/yaml.v2"
|
||||
@@ -182,3 +183,18 @@ func TestRole_UnmarshalYAML_InvalidRole(t *testing.T) {
|
||||
assert.Error(t, err)
|
||||
assert.Contains(t, err.Error(), "invalid Role")
|
||||
}
|
||||
|
||||
func TestSchemaValidationErr_BecknError_NoErrors(t *testing.T) {
|
||||
schemaValidationErr := &SchemaValidationErr{Errors: nil}
|
||||
beErr := schemaValidationErr.BecknError()
|
||||
|
||||
expectedMsg := "Schema validation error."
|
||||
expectedCode := http.StatusText(http.StatusBadRequest)
|
||||
|
||||
if beErr.Message != expectedMsg {
|
||||
t.Errorf("beErr.Message = %s, want %s", beErr.Message, expectedMsg)
|
||||
}
|
||||
if beErr.Code != expectedCode {
|
||||
t.Errorf("beErr.Code = %s, want %s", beErr.Code, expectedCode)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user