WIP: console package tests (palette)

20% code coverage.
This commit is contained in:
Ivan Marquez 2019-09-07 20:46:58 -04:00
parent bafa0963ec
commit 44f9ba7441
1 changed files with 32 additions and 0 deletions

32
console/palette_test.go Normal file
View File

@ -0,0 +1,32 @@
package console
import "testing"
func TestGetPalette(t *testing.T) {
var (
darkPalette = Palette{
BaseColor: ColorWhite,
ReverseColor: ColorBlack,
}
lightPalette = Palette{
BaseColor: ColorBlack,
ReverseColor: ColorWhite,
}
)
tests := []struct {
name string
input Theme
want Palette
}{
{"should return dark theme with base color white", ThemeDark, darkPalette},
{"should return light theme with base color black", ThemeLight, lightPalette},
}
for _, test := range tests {
palette := GetPalette(test.input)
if got := palette.BaseColor; got != test.want.BaseColor {
t.Errorf("GetPalette(%q) = %d, want %d", test.input, got, test.want.BaseColor)
}
}
}