You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

76 lines
1.4 KiB

2 months ago
package errors
import (
"reflect"
"testing"
)
func TestFromError(t *testing.T) {
type args struct {
err error
}
tests := []struct {
name string
args args
want *HTTPError
}{
// TODO: Add test cases.
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
if got := FromError(tt.args.err); !reflect.DeepEqual(got, tt.want) {
t.Errorf("FromError() = %v, want %v", got, tt.want)
}
})
}
}
func TestHTTPError_Error(t *testing.T) {
type fields struct {
Message string
Code int
Data interface{}
}
tests := []struct {
name string
fields fields
want string
}{
// TODO: Add test cases.
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
e := &HTTPError{
Message: tt.fields.Message,
Code: tt.fields.Code,
Data: tt.fields.Data,
}
if got := e.Error(); got != tt.want {
t.Errorf("Error() = %v, want %v", got, tt.want)
}
})
}
}
func TestNewHTTPError(t *testing.T) {
type args struct {
code int
data interface{}
detail string
}
tests := []struct {
name string
args args
want *HTTPError
}{
// TODO: Add test cases.
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
if got := NewHTTPError(tt.args.code, tt.args.data, tt.args.detail); !reflect.DeepEqual(got, tt.want) {
t.Errorf("NewHTTPError() = %v, want %v", got, tt.want)
}
})
}
}