29 lines
865 B
Go
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)
|
|
}
|
|
}
|
|
})
|
|
}
|
|
}
|