Files
galaxy-game/internal/controller/race_test.go
T
2026-01-14 22:17:24 +02:00

23 lines
673 B
Go

package controller_test
import (
"testing"
e "github.com/iliadenisov/galaxy/internal/error"
"github.com/stretchr/testify/assert"
)
func TestGiveVotes(t *testing.T) {
c, _ := newCache()
assert.Equal(t, c.Voted(Race_0_idx), Race_0_idx)
assert.Equal(t, c.Voted(Race_1_idx), Race_1_idx)
assert.NoError(t, c.GiveVotes(Race_0.Name, Race_1.Name))
assert.Equal(t, Race_1_idx, c.Voted(Race_0_idx))
assert.Equal(t, Race_1_idx, c.Voted(Race_1_idx))
assert.ErrorContains(t, c.GiveVotes("UnknownRace", Race_1.Name), e.GenericErrorText(e.ErrInputUnknownRace))
assert.ErrorContains(t, c.GiveVotes(Race_0.Name, "UnknownRace"), e.GenericErrorText(e.ErrInputUnknownRace))
}