feat: command validation

This commit is contained in:
IliaDenisov
2026-02-10 18:31:53 +03:00
parent b5400bd61e
commit 6c8384ce7a
6 changed files with 178 additions and 30 deletions
+11
View File
@@ -1,6 +1,8 @@
package router_test
import (
"encoding/json"
"github.com/gin-gonic/gin"
"github.com/google/uuid"
"github.com/iliadenisov/galaxy/internal/model/rest"
@@ -24,5 +26,14 @@ func (e *dummyExecutor) GameState() (rest.StateResponse, error) {
}
func setupRouter() *gin.Engine {
gin.SetMode(gin.TestMode)
return router.SetupRouter(&dummyExecutor{})
}
func encodeCommand(cmd any) json.RawMessage {
v, err := json.Marshal(cmd)
if err != nil {
panic(err)
}
return v
}