Files
iqudo-top1/internal/multitable/projector_test.go
Eric 1549169735@qq.com da3f16e6db update
2026-09-13 20:08:13 +08:00

29 lines
865 B
Go

package multitable
import (
"testing"
"time"
"git.iwork-ai.com/xdc/iqudo-top1/internal/model"
)
func TestNewResourceProjections(t *testing.T) {
now := time.Date(2026, 8, 12, 12, 0, 0, 0, time.UTC)
tests := []struct {
name string
data map[string]interface{}
want map[string]interface{}
}{
{"scenario rule", scenarioRuleProjection(model.ScenarioRule{Base: model.Base{ID: 11, UpdatedAt: now}, TenantID: 2, ScenarioID: 3, RuleKey: "match", Name: "匹配", Priority: 10, Status: "active"}, "正常"), map[string]interface{}{"来源ID": "11", "场景来源ID": "3", "规则标识": "match", "优先级": 10}},
}
for _, test := range tests {
t.Run(test.name, func(t *testing.T) {
for key, want := range test.want {
if got := test.data[key]; got != want {
t.Fatalf("%s=%v want %v; data=%#v", key, got, want, test.data)
}
}
})
}
}