Files
knowledge-governance/internal/qaopsmirror/dashboard_test.go
T
姚章浩 6e67034fbd
build / build (push) Successful in 1m10s
feat(qa-ops): 交付十一项统计看板与完整图片导出
以治理库单一只读事务分开聚合累计、自然周、截止月及当前通讯录使用分母;浏览器不再读取全量长答案来构建看板。

新增迁移52与普通worker周质量冻结,保留真实冻结时点、规则和标量贡献;缺少当时快照留空。提交后冻结头与贡献不可修改、删除或追加;只读接口保留管理员、固定租户、严格JSON与输入冲突保护。

已验证:make verify退出0,686个Go用例和305个前端用例通过,必需跳过0;镜像与组织隔离PostgreSQL竞态回归退出0。真实治理副本浏览器核对第41周累计1885与新增471、十一项和完整PNG下载,390px无外溢、JS异常0;明确模拟503后不伪零且重试恢复。没有修改DobotAI原始问答、真实区域规则或生产发布门禁。
2026-10-18 23:26:55 +08:00

28 lines
998 B
Go

package qaopsmirror
import (
"testing"
"time"
)
func TestDashboardPeriodsUseBeijingAndPreviousSundayAtExclusiveEnd(t *testing.T) {
end := time.Date(2026, 11, 2, 0, 0, 0, 0, time.FixedZone("CST", 8*3600))
month, week := dashboardPeriods(end)
if month.Format(time.RFC3339) != "2026-11-01T00:00:00+08:00" || week.Format(time.RFC3339) != "2026-10-26T00:00:00+08:00" {
t.Fatal("exclusive Monday end was assigned to the wrong source week/month")
}
}
func TestDashboardFrozenGapsNeverUseCurrentRates(t *testing.T) {
start := time.Date(2026, 9, 28, 0, 0, 0, 0, time.FixedZone("CST", 8*3600))
end := start.AddDate(0, 0, 21)
points := dashboardFrozenSeries(start, end, nil)
if len(points) != 3 {
t.Fatal("must include each source natural week including missing snapshots")
}
for _, point := range points {
if point.FrozenAt != nil || point.Coverage.Percent != nil || point.Correctness.Percent != nil {
t.Fatal("missing historical snapshots were fabricated from current data")
}
}
}