wip: refactor controller
This commit is contained in:
@@ -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))
|
||||
}
|
||||
Reference in New Issue
Block a user