Refactor match sounds such that they only need to be listed in one place.

This commit is contained in:
Patrick Fairbank
2019-07-20 23:23:26 -07:00
parent 02fa6954bd
commit e755913151
16 changed files with 26 additions and 23 deletions

View File

@@ -6,6 +6,7 @@
package web
import (
"github.com/Team254/cheesy-arena/game"
"github.com/Team254/cheesy-arena/model"
"github.com/Team254/cheesy-arena/websocket"
"net/http"
@@ -29,7 +30,8 @@ func (web *Web) audienceDisplayHandler(w http.ResponseWriter, r *http.Request) {
data := struct {
*model.EventSettings
}{web.arena.EventSettings}
MatchSounds []*game.MatchSound
}{web.arena.EventSettings, game.MatchSounds}
err = template.ExecuteTemplate(w, "audience_display.html", data)
if err != nil {
handleWebErr(w, err)

View File

@@ -64,7 +64,7 @@ func TestAudienceDisplayWebsocket(t *testing.T) {
}
sound, ok := messages["playSound"]
if assert.True(t, ok) {
assert.Equal(t, "match-start", sound)
assert.Equal(t, "start", sound)
}
_, ok = messages["matchTime"]
assert.True(t, ok)