Skip to content

Commit

Permalink
refactor: remove unused test functions from turtleware_suite_test
Browse files Browse the repository at this point in the history
  • Loading branch information
kernle32dll committed Jun 19, 2023
1 parent 29246d5 commit f5e7a06
Showing 1 changed file with 0 additions and 27 deletions.
27 changes: 0 additions & 27 deletions turtleware_suite_test.go
Original file line number Diff line number Diff line change
@@ -1,37 +1,10 @@
package turtleware_test

import (
"github.com/kernle32dll/turtleware"

"context"
"net/http"
"net/http/httptest"
)

// ExpectedError creates an error output, as returned by turtleware.
func ExpectedError(status int, errors ...error) []byte {
errorList := make([]string, len(errors))
for i, err := range errors {
errorList[i] = err.Error()
}

errObj := struct {
Status int `json:"status"`
Text string `json:"text"`
Errors []string `json:"errors"`
}{
Status: status,
Text: http.StatusText(status),
Errors: errorList,
}

rec := httptest.NewRecorder()

turtleware.EmissioneWriter.Write(rec, &http.Request{}, status, errObj)

return rec.Body.Bytes()
}

// ErrorHandlerCapture is a helper struct to capture errors for a turtleware.ErrorHandlerFunc.
type ErrorHandlerCapture struct {
CapturedError error
Expand Down

0 comments on commit f5e7a06

Please sign in to comment.