@@ -0,0 +1,30 @@
|
||||
package router
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
func TestVideoPlayConsumeRoute(t *testing.T) {
|
||||
gin.SetMode(gin.TestMode)
|
||||
engine := gin.New()
|
||||
vidRouter(engine.Group("/api/app"))
|
||||
|
||||
foundConsume := false
|
||||
foundLegacyCount := false
|
||||
for _, route := range engine.Routes() {
|
||||
if route.Method == "POST" && route.Path == "/api/app/vid/play/consume" {
|
||||
foundConsume = true
|
||||
}
|
||||
if route.Method == "GET" && route.Path == "/api/app/vid/user/count" {
|
||||
foundLegacyCount = true
|
||||
}
|
||||
}
|
||||
if !foundConsume {
|
||||
t.Error("POST /api/app/vid/play/consume is not registered")
|
||||
}
|
||||
if !foundLegacyCount {
|
||||
t.Error("legacy GET /api/app/vid/user/count is not registered")
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user