feat: game session, turn system, lobby, and room events
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
29
game/session_test.go
Normal file
29
game/session_test.go
Normal file
@@ -0,0 +1,29 @@
|
||||
package game
|
||||
|
||||
import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/tolelom/catacombs/entity"
|
||||
)
|
||||
|
||||
func TestSessionTurnTimeout(t *testing.T) {
|
||||
s := NewGameSession()
|
||||
p := entity.NewPlayer("test", entity.ClassWarrior)
|
||||
s.AddPlayer(p)
|
||||
s.StartFloor()
|
||||
|
||||
// Don't submit any action, wait for timeout
|
||||
done := make(chan struct{})
|
||||
go func() {
|
||||
s.RunTurn()
|
||||
close(done)
|
||||
}()
|
||||
|
||||
select {
|
||||
case <-done:
|
||||
// Turn completed via timeout
|
||||
case <-time.After(7 * time.Second):
|
||||
t.Error("Turn did not timeout within 7 seconds")
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user