goonscape/game/test_setup.go

27 lines
564 B
Go
Raw Permalink Normal View History

package game
import (
"testing"
"gitea.boner.be/bdnugget/goonscape/game/mock"
"gitea.boner.be/bdnugget/goonscape/game/testutils"
)
func setupTestEnvironment(t *testing.T) (*Game, func()) {
testutils.ResetMockInput()
testutils.SetupMockFunctions()
game := New()
game.input = &MockInput{}
game.Chat.input = &MockInput{} // Also inject mock input into chat
// Verify mock setup
if mock.IsKeyPressed == nil || mock.GetCharPressed == nil {
t.Fatal("Mock functions not properly initialized")
}
return game, func() {
testutils.ResetMockInput()
}
}