mirror of
https://github.com/get-drexa/drive.git
synced 2026-02-02 10:31:16 +00:00
test(backend): add ErrorHandler to HTTP tests
This commit is contained in:
@@ -17,6 +17,7 @@ import (
|
||||
"github.com/get-drexa/drexa/internal/account"
|
||||
"github.com/get-drexa/drexa/internal/auth"
|
||||
"github.com/get-drexa/drexa/internal/database"
|
||||
"github.com/get-drexa/drexa/internal/httperr"
|
||||
"github.com/get-drexa/drexa/internal/organization"
|
||||
"github.com/get-drexa/drexa/internal/password"
|
||||
"github.com/get-drexa/drexa/internal/user"
|
||||
@@ -247,7 +248,9 @@ func newAuthApp(t *testing.T, ctx context.Context) *fiber.App {
|
||||
SecretKey: []byte("drexa-test-secret"),
|
||||
})
|
||||
|
||||
app := fiber.New()
|
||||
app := fiber.New(fiber.Config{
|
||||
ErrorHandler: httperr.ErrorHandler,
|
||||
})
|
||||
api := app.Group("/api")
|
||||
auth.NewHTTPHandler(authSvc, orgSvc, db, auth.CookieConfig{}).RegisterRoutes(api)
|
||||
|
||||
|
||||
@@ -18,6 +18,7 @@ import (
|
||||
"github.com/get-drexa/drexa/internal/blob"
|
||||
"github.com/get-drexa/drexa/internal/database"
|
||||
"github.com/get-drexa/drexa/internal/drive"
|
||||
"github.com/get-drexa/drexa/internal/httperr"
|
||||
"github.com/get-drexa/drexa/internal/organization"
|
||||
"github.com/get-drexa/drexa/internal/registration"
|
||||
"github.com/get-drexa/drexa/internal/user"
|
||||
@@ -91,7 +92,9 @@ func TestHTTP_OrganizationEndpoints(t *testing.T) {
|
||||
|
||||
authMiddleware := auth.NewAuthMiddleware(authSvc, db, auth.CookieConfig{})
|
||||
|
||||
app := fiber.New()
|
||||
app := fiber.New(fiber.Config{
|
||||
ErrorHandler: httperr.ErrorHandler,
|
||||
})
|
||||
api := app.Group("/api")
|
||||
usersAPI := user.NewHTTPHandler(userSvc, db, authMiddleware).RegisterRoutes(api)
|
||||
|
||||
|
||||
@@ -19,6 +19,7 @@ import (
|
||||
"github.com/get-drexa/drexa/internal/blob"
|
||||
"github.com/get-drexa/drexa/internal/database"
|
||||
"github.com/get-drexa/drexa/internal/drive"
|
||||
"github.com/get-drexa/drexa/internal/httperr"
|
||||
"github.com/get-drexa/drexa/internal/organization"
|
||||
"github.com/get-drexa/drexa/internal/registration"
|
||||
"github.com/get-drexa/drexa/internal/user"
|
||||
@@ -76,7 +77,9 @@ func TestHTTP_RegisterAccount_TokenDeliveryBody(t *testing.T) {
|
||||
SecretKey: []byte("drexa-test-secret"),
|
||||
})
|
||||
|
||||
app := fiber.New()
|
||||
app := fiber.New(fiber.Config{
|
||||
ErrorHandler: httperr.ErrorHandler,
|
||||
})
|
||||
api := app.Group("/api")
|
||||
registration.NewHTTPHandler(regSvc, authSvc, db, auth.CookieConfig{}).RegisterRoutes(api)
|
||||
|
||||
@@ -176,7 +179,9 @@ func TestHTTP_RegisterAccount_TokenDeliveryCookie(t *testing.T) {
|
||||
SecretKey: []byte("drexa-test-secret"),
|
||||
})
|
||||
|
||||
app := fiber.New()
|
||||
app := fiber.New(fiber.Config{
|
||||
ErrorHandler: httperr.ErrorHandler,
|
||||
})
|
||||
api := app.Group("/api")
|
||||
registration.NewHTTPHandler(regSvc, authSvc, db, auth.CookieConfig{}).RegisterRoutes(api)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user