test: multiple commands
This commit is contained in:
@@ -11,9 +11,11 @@ import (
|
||||
)
|
||||
|
||||
type dummyExecutor struct {
|
||||
CommandsExecuted int
|
||||
}
|
||||
|
||||
func (e *dummyExecutor) Execute(cmd ...handler.Command) error {
|
||||
func (e *dummyExecutor) Execute(command ...handler.Command) error {
|
||||
e.CommandsExecuted = len(command)
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -26,8 +28,16 @@ func (e *dummyExecutor) GameState() (rest.StateResponse, error) {
|
||||
}
|
||||
|
||||
func setupRouter() *gin.Engine {
|
||||
return setupRouterExecutor(newExecutor())
|
||||
}
|
||||
|
||||
func setupRouterExecutor(e handler.CommandExecutor) *gin.Engine {
|
||||
gin.SetMode(gin.TestMode)
|
||||
return router.SetupRouter(&dummyExecutor{})
|
||||
return router.SetupRouter(e)
|
||||
}
|
||||
|
||||
func newExecutor() handler.CommandExecutor {
|
||||
return &dummyExecutor{}
|
||||
}
|
||||
|
||||
func encodeCommand(cmd any) json.RawMessage {
|
||||
|
||||
Reference in New Issue
Block a user