Files
huangguo_server/app/router/ai_mate_test.go
T
rootandClaude Opus 5 8679200f41 Initial commit
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-15 13:57:10 +08:00

57 lines
1.3 KiB
Go

package router
import (
"testing"
"github.com/gin-gonic/gin"
)
func TestAiMateH5CompatibilityRoutes(t *testing.T) {
gin.SetMode(gin.TestMode)
engine := gin.New()
aiMateRouter(engine.Group("/api/app"))
routes := make(map[string]struct{})
for _, route := range engine.Routes() {
routes[route.Method+" "+route.Path] = struct{}{}
}
expected := []string{
"GET /api/app/aimate/login",
"GET /api/app/aimate/getBalance",
"GET /api/app/aimate/gianBalance",
"GET /api/app/aimate/currencys",
"POST /api/app/aimate/exchange",
}
for _, route := range expected {
if _, ok := routes[route]; !ok {
t.Errorf("route %q is not registered", route)
}
}
}
func TestAiMateV2Route(t *testing.T) {
gin.SetMode(gin.TestMode)
engine := gin.New()
aiMateV2Router(engine.Group("/api/app"))
for _, route := range engine.Routes() {
if route.Method == "POST" && route.Path == "/api/app/aimatev2/url" {
return
}
}
t.Fatal("POST /api/app/aimatev2/url is not registered")
}
func TestContentUpdateMarkerRoute(t *testing.T) {
gin.SetMode(gin.TestMode)
engine := gin.New()
contentMarkerRouter(engine.Group("/api/app"))
for _, route := range engine.Routes() {
if route.Method == "GET" && route.Path == "/api/app/content/update-markers" {
return
}
}
t.Fatal("GET /api/app/content/update-markers is not registered")
}