Fix tests after last change.

This commit is contained in:
Patrick Fairbank
2019-04-12 17:32:40 -07:00
parent 74c1063a2d
commit 0f74de7ad8
7 changed files with 37 additions and 6 deletions

View File

@@ -60,7 +60,7 @@ func TestAllianceStationDisplayWebsocket(t *testing.T) {
web.arena.AllianceStations["B3"].Bypass = true
web.arena.StartMatch()
web.arena.Update()
messages := readWebsocketMultiple(t, ws, 2)
messages := readWebsocketMultiple(t, ws, 3)
_, ok := messages["matchTime"]
assert.True(t, ok)
web.arena.MatchStartTime = time.Now().Add(-time.Duration(game.MatchTiming.WarmupDurationSec) * time.Second)

View File

@@ -350,7 +350,7 @@ func TestMatchPlayWebsocketNotifications(t *testing.T) {
web.arena.AllianceStations["B3"].Bypass = true
assert.Nil(t, web.arena.StartMatch())
web.arena.Update()
messages := readWebsocketMultiple(t, ws, 3)
messages := readWebsocketMultiple(t, ws, 4)
_, ok := messages["matchTime"]
assert.True(t, ok)
_, ok = messages["audienceDisplayMode"]
@@ -364,7 +364,6 @@ func TestMatchPlayWebsocketNotifications(t *testing.T) {
assert.Equal(t, true, statusReceived)
assert.Equal(t, 3, matchTime.MatchState)
assert.Equal(t, 3, matchTime.MatchTimeSec)
assert.True(t, ok)
web.arena.ScoringStatusNotifier.Notify()
readWebsocketType(t, ws, "scoringStatus")

View File

@@ -5,6 +5,7 @@ package web
import (
"github.com/Team254/cheesy-arena/field"
"github.com/Team254/cheesy-arena/game"
"github.com/Team254/cheesy-arena/websocket"
"github.com/stretchr/testify/assert"
"net/http"
@@ -83,6 +84,8 @@ func readWebsocketMultiple(t *testing.T, ws *websocket.Websocket, count int) map
}
func setupTestWeb(t *testing.T) *Web {
game.MatchTiming.WarmupDurationSec = 3
game.MatchTiming.PauseDurationSec = 2
arena := field.SetupTestArena(t, "web")
return NewWeb(arena)
}