1package common_test23import (4 "testing"56 "github.com/charmbracelet/soft-serve/pkg/ui/common"7)89func TestIsFileMarkdown(t *testing.T) {10 cases := []struct {11 name string12 filename string13 content string // XXX: chroma doesn't correctly analyze mk files14 isMkd bool15 }{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 }2223 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}