wip: refactor controller

This commit is contained in:
Ilia Denisov
2026-01-14 22:17:24 +02:00
parent 1bfc9242af
commit fe8a8d4150
43 changed files with 4710 additions and 2188 deletions
+22
View File
@@ -0,0 +1,22 @@
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))
}