116 lines
2.6 KiB
Go
116 lines
2.6 KiB
Go
|
|
//go:build llm_script
|
||
|
|
|
||
|
|
package main
|
||
|
|
|
||
|
|
import (
|
||
|
|
"os"
|
||
|
|
"path/filepath"
|
||
|
|
"strings"
|
||
|
|
"testing"
|
||
|
|
)
|
||
|
|
|
||
|
|
func TestGenerateMarkdownV3IncludesTencentSubscriptionSection(t *testing.T) {
|
||
|
|
path := filepath.Join(t.TempDir(), "daily_report.md")
|
||
|
|
report := &ReportV3{
|
||
|
|
Date: "2026-05-13",
|
||
|
|
TotalModels: 502,
|
||
|
|
QualitySummary: DataQualitySummary{
|
||
|
|
Total: 502,
|
||
|
|
Fresh: 490,
|
||
|
|
CNY: 126,
|
||
|
|
USD: 376,
|
||
|
|
},
|
||
|
|
TencentSubscriptionPlans: []SubscriptionPlanInfo{
|
||
|
|
{
|
||
|
|
PlanName: "通用 Token Plan Lite",
|
||
|
|
PlanFamily: "token_plan",
|
||
|
|
Tier: "Lite",
|
||
|
|
Currency: "CNY",
|
||
|
|
ListPrice: 39,
|
||
|
|
QuotaValue: 35000000,
|
||
|
|
QuotaUnit: "tokens/month",
|
||
|
|
ContextWindow: 0,
|
||
|
|
ModelCount: 10,
|
||
|
|
ModelPreview: "tc-code-latest, glm-5, glm-5.1",
|
||
|
|
},
|
||
|
|
{
|
||
|
|
PlanName: "Hy Token Plan Max",
|
||
|
|
PlanFamily: "token_plan",
|
||
|
|
Tier: "Max",
|
||
|
|
Currency: "CNY",
|
||
|
|
ListPrice: 468,
|
||
|
|
QuotaValue: 650000000,
|
||
|
|
QuotaUnit: "tokens/month",
|
||
|
|
ContextWindow: 262144,
|
||
|
|
ModelCount: 1,
|
||
|
|
ModelPreview: "hy3-preview",
|
||
|
|
},
|
||
|
|
},
|
||
|
|
}
|
||
|
|
|
||
|
|
if err := generateMarkdownV3(report, path); err != nil {
|
||
|
|
t.Fatalf("generateMarkdownV3 returned error: %v", err)
|
||
|
|
}
|
||
|
|
|
||
|
|
body, err := os.ReadFile(path)
|
||
|
|
if err != nil {
|
||
|
|
t.Fatalf("read markdown output: %v", err)
|
||
|
|
}
|
||
|
|
|
||
|
|
content := string(body)
|
||
|
|
for _, want := range []string{
|
||
|
|
"## 💳 腾讯云套餐订阅价",
|
||
|
|
"通用 Token Plan Lite",
|
||
|
|
"Hy Token Plan Max",
|
||
|
|
"¥39.00/月",
|
||
|
|
"3500万 Tokens/月",
|
||
|
|
"256K",
|
||
|
|
} {
|
||
|
|
if !strings.Contains(content, want) {
|
||
|
|
t.Fatalf("markdown missing %q\n%s", want, content)
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
func TestGenerateHTMLV3IncludesTencentSubscriptionSection(t *testing.T) {
|
||
|
|
path := filepath.Join(t.TempDir(), "daily_report.html")
|
||
|
|
report := &ReportV3{
|
||
|
|
Date: "2026-05-13",
|
||
|
|
TotalModels: 502,
|
||
|
|
TencentSubscriptionPlans: []SubscriptionPlanInfo{
|
||
|
|
{
|
||
|
|
PlanName: "通用 Token Plan Lite",
|
||
|
|
PlanFamily: "token_plan",
|
||
|
|
Tier: "Lite",
|
||
|
|
Currency: "CNY",
|
||
|
|
ListPrice: 39,
|
||
|
|
QuotaValue: 35000000,
|
||
|
|
QuotaUnit: "tokens/month",
|
||
|
|
ModelCount: 10,
|
||
|
|
ModelPreview: "tc-code-latest, glm-5, glm-5.1",
|
||
|
|
},
|
||
|
|
},
|
||
|
|
}
|
||
|
|
|
||
|
|
if err := generateHTMLV3(report, path); err != nil {
|
||
|
|
t.Fatalf("generateHTMLV3 returned error: %v", err)
|
||
|
|
}
|
||
|
|
|
||
|
|
body, err := os.ReadFile(path)
|
||
|
|
if err != nil {
|
||
|
|
t.Fatalf("read html output: %v", err)
|
||
|
|
}
|
||
|
|
|
||
|
|
content := string(body)
|
||
|
|
for _, want := range []string{
|
||
|
|
"💳 腾讯云套餐订阅价",
|
||
|
|
"通用 Token Plan Lite",
|
||
|
|
"¥39.00/月",
|
||
|
|
"3500万 Tokens/月",
|
||
|
|
} {
|
||
|
|
if !strings.Contains(content, want) {
|
||
|
|
t.Fatalf("html missing %q\n%s", want, content)
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|