27 lines
564 B
Go
27 lines
564 B
Go
|
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()
|
||
|
}
|
||
|
}
|