1package common_test
 2
 3import (
 4	"testing"
 5
 6	"github.com/charmbracelet/soft-serve/pkg/ui/common"
 7)
 8
 9func TestIsFileMarkdown(t *testing.T) {
10	cases := []struct {
11		name     string
12		filename string
13		content  string // XXX: chroma doesn't correctly analyze mk files
14		isMkd    bool
15	}{
16		{"simple", "README.md", "", true},
17		{"empty", "", "", false},
18		{"no extension", "README", "", false},
19		{"weird extension", "README.foo", "", false},
20		{"long ext", "README.markdown", "", true},
21	}
22
23	for _, c := range cases {
24		t.Run(c.name, func(t *testing.T) {
25			if got := common.IsFileMarkdown(c.content, c.filename); got != c.isMkd {
26				t.Errorf("IsFileMarkdown(%q, %q) = %v, want %v", c.content, c.filename, got, c.isMkd)
27			}
28		})
29	}
30}