package controller_test import ( "testing" e "github.com/iliadenisov/galaxy/internal/error" "github.com/stretchr/testify/assert" ) func TestGiveVotes(t *testing.T) { c, g := 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, g.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, g.GiveVotes("UnknownRace", Race_1.Name), e.GenericErrorText(e.ErrInputUnknownRace)) assert.ErrorContains(t, g.GiveVotes(Race_0.Name, "UnknownRace"), e.GenericErrorText(e.ErrInputUnknownRace)) }