Refactor import paths to use internal/pkg/httpx/params
- Updated multiple repository and service files to replace imports from "github.com/mlogclub/simple/web/params" with "cs-agent/internal/pkg/httpx/params". - Adjusted context handling in auth_service and ws_service to use gin.Context instead of iris.Context. - Ensured consistent usage of HTTP status responses across websocket handlers.
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
package bootstrap
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"testing"
|
||||
|
||||
"cs-agent/internal/pkg/config"
|
||||
)
|
||||
|
||||
func TestNewServerRegistersGinRoutes(t *testing.T) {
|
||||
config.SetCurrent(&config.Config{
|
||||
Storage: config.StorageConfig{
|
||||
Local: config.LocalStorageConfig{
|
||||
Root: "storage",
|
||||
BaseURL: "/storage",
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
app, err := NewServer()
|
||||
if err != nil {
|
||||
t.Fatalf("NewServer() error = %v", err)
|
||||
}
|
||||
|
||||
routes := make(map[string]bool)
|
||||
for _, route := range app.Routes() {
|
||||
routes[route.Method+" "+route.Path] = true
|
||||
}
|
||||
|
||||
expected := []string{
|
||||
http.MethodPost + " /api/auth/login",
|
||||
http.MethodGet + " /api/auth/profile",
|
||||
http.MethodGet + " /api/dashboard/user/list",
|
||||
http.MethodGet + " /api/dashboard/user/:id",
|
||||
http.MethodPost + " /api/dashboard/user/create",
|
||||
http.MethodPost + " /api/dashboard/conversation/send_message",
|
||||
http.MethodGet + " /api/ws/dashboard",
|
||||
http.MethodGet + " /api/ws/open",
|
||||
}
|
||||
for _, route := range expected {
|
||||
if !routes[route] {
|
||||
t.Fatalf("expected route %s to be registered", route)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user