package presentation_test import ( "testing" "git.sapphic.engineer/roleypoly/v4/presentation" "git.sapphic.engineer/roleypoly/v4/types/fixtures" "github.com/stretchr/testify/assert" ) func TestRole(t *testing.T) { r := presentation.Role(&fixtures.CategoryMulti, &fixtures.RoleWithDarkColor, true) assert.Equal(t, fixtures.RoleWithDarkColor.ID, r.ID) assert.Equal(t, fixtures.RoleWithDarkColor.Name, r.Name) assert.Equal(t, presentation.InputCheckbox, r.InputType) assert.Equal(t, "#a20000", r.Colors.Main) assert.True(t, r.Selected) r = presentation.Role(&fixtures.CategorySingle, &fixtures.RoleWithDarkColor, false) assert.Equal(t, presentation.InputRadio, r.InputType) assert.False(t, r.Selected) r = presentation.Role(&fixtures.CategorySingle, &fixtures.RoleWithLightColor, true) assert.True(t, r.Selected) } func TestGetColors(t *testing.T) { c := presentation.GetColors(0xa20000) assert.Equal(t, "#a20000", c.Main) assert.Equal(t, "#ffd8d8", c.Alt) }