This repository has been archived on 2022-05-06. You can view files and clone it, but cannot push or open issues/pull-requests.
chromajson/chromajson_test.go

32 lines
1.0 KiB
Go

package chromajson
import (
"testing"
"github.com/matryer/is"
)
func TestStyleEntry(t *testing.T) {
tt := []struct {
Name string
Entry *StyleEntry
Expected string
}{
{Name: "color1", Entry: &StyleEntry{Color: "#FFF"}, Expected: "#FFF"},
{Name: "color2", Entry: &StyleEntry{Color: "white"}, Expected: "#white"},
{Name: "background1", Entry: &StyleEntry{Background: "#FFF"}, Expected: "bg:#FFF"},
{Name: "background2", Entry: &StyleEntry{Background: "white"}, Expected: "bg:#white"},
{Name: "border1", Entry: &StyleEntry{Border: "#FFF"}, Expected: "border:#FFF"},
{Name: "border2", Entry: &StyleEntry{Border: "white"}, Expected: "border:#white"},
{Name: "accent", Entry: &StyleEntry{Accents: []string{"bold"}}, Expected: "bold"},
{Name: "mix", Entry: &StyleEntry{Color: "black", Accents: []string{"bold"}, Background: "#ffffff"}, Expected: "bold bg:#ffffff #black"},
}
for _, tc := range tt {
t.Run(tc.Name, func(t *testing.T) {
assert := is.New(t)
assert.Equal(tc.Entry.String(), tc.Expected)
})
}
}