MCPcopy Create free account
hub / github.com/devaccuracy/ledgerforge / TestNewAPIError

Function TestNewAPIError

internal/apierror/apierror_test.go:28–36  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

26)
27
28func TestNewAPIError(t *testing.T) {
29 details := "Some internal error details"
30 apiErr := apierror.NewAPIError(apierror.ErrInternalServer, "Something went wrong", details)
31
32 assert.Equal(t, apierror.ErrInternalServer, apiErr.Code)
33 assert.Equal(t, "Something went wrong", apiErr.Message)
34 assert.Equal(t, details, apiErr.Details)
35 assert.Equal(t, "INTERNAL_SERVER_ERROR: Something went wrong", apiErr.Error())
36}
37
38func TestMapErrorToHTTPStatus(t *testing.T) {
39 tests := []struct {

Callers

nothing calls this directly

Calls 2

ErrorMethod · 0.95
NewAPIErrorFunction · 0.92

Tested by

no test coverage detected