Files
reloading-manager/backend/handlers/responses_test.go
Ron Rise dd383b6fb3
All checks were successful
🧪 ✨ Unit Tests Workflow / 🧪 📜 JavaScript Tests (push) Successful in 7m28s
🧪 ✨ Unit Tests Workflow / 🧪 🐹 GolangCI-Lint (push) Successful in 7m40s
🧪 ✨ Unit Tests Workflow / 🔍 🐹 Go Tests (push) Successful in 10m24s
fix tpyo (#8)
Reviewed-on: Siteworxpro/reloading-manager#8
Co-authored-by: Ron Rise <ron@siteworxpro.com>
Co-committed-by: Ron Rise <ron@siteworxpro.com>
2025-06-10 15:56:03 +00:00

38 lines
544 B
Go

package handlers
import (
"github.com/labstack/echo/v4"
"testing"
)
type TestContext struct {
echo.Context
t *testing.T
}
func (t TestContext) JSON(code int, i interface{}) error {
if code != 400 {
t.t.Fatal("expected 400")
}
switch i.(type) {
case Response[string]:
break
default:
t.t.Fatal("expected response")
}
return nil
}
func TestBadRequest(t *testing.T) {
context := TestContext{
t: t,
}
err := BadRequest(context, "Something is wrong")
if err != nil {
t.Errorf("Should not have returned an error")
}
}