Files
Agent-System-Backend/internal/runtime/material_choice_notice_test.go
T

27 lines
931 B
Go

package runtime
import (
"encoding/json"
"strings"
"testing"
)
func TestMaterialChoiceNoticeAcceptsFourBoundedChineseOptions(t *testing.T) {
items := []materialChoiceData{
{Label: "会议摘要", Basis: strings.Repeat("依据", 90)},
{Label: "验收清单", Basis: strings.Repeat("依据", 90)},
{Label: "联调计划", Basis: strings.Repeat("依据", 90)},
{Label: "范围对照", Basis: strings.Repeat("依据", 90)},
}
raw, err := json.Marshal(items)
if err != nil {
t.Fatal(err)
}
notice := "<system-reminder>\n后台子代理「材料整理」已结束。\n状态:completed\n" +
MaterialChoiceOptionsPrefix + string(raw) + "\n" + MaterialChoiceReadyMarker + "\n</system-reminder>"
choices := materialOptionsFromNotice(notice)
if len(choices) != 4 || choices[0].Label != "会议摘要" || choices[3].Label != "范围对照" {
t.Fatalf("four valid bounded options were lost: %d", len(choices))
}
}