package mcp

import (
	"testing"

	"github.com/sundynix/sundynix-mcp-go/internal/office"
)

func TestReportMarkdown(t *testing.T) {
	src := reportSource{
		Title: "咖啡",
		Sections: []office.Section{
			{Heading: "提神", Body: " 含咖啡因 "},
			{Heading: "风险", Body: "过量失眠"},
		},
	}
	got := reportMarkdown(src)
	want := "# 咖啡\n\n## 提神\n\n含咖啡因\n\n## 风险\n\n过量失眠\n\n"
	if got != want {
		t.Errorf("reportMarkdown =\n%q\nwant\n%q", got, want)
	}
}

func TestReportMarkdown_NoTitle(t *testing.T) {
	got := reportMarkdown(reportSource{Sections: []office.Section{{Heading: "H", Body: "B"}}})
	want := "## H\n\nB\n\n"
	if got != want {
		t.Errorf("无标题 reportMarkdown = %q, want %q", got, want)
	}
}
