31 lines
962 B
Go
31 lines
962 B
Go
package service
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"cmautobuy/admin/model"
|
|
)
|
|
|
|
func TestInnerCodeRowView_只有可回写记录可选择(t *testing.T) {
|
|
for _, status := range []model.InnerCodeStatus{
|
|
model.InnerCodePending, model.InnerCodeReady, model.InnerCodeApplying,
|
|
model.InnerCodeUpdated, model.InnerCodeAlreadyFilled, model.InnerCodeSkipped,
|
|
model.InnerCodeFailed, model.InnerCodeNeedsCheck,
|
|
} {
|
|
view := innerCodeRowView(model.InnerCodeRecord{Status: status, RemoteInnerCode: "OLD"})
|
|
if view.CanSelect != (status == model.InnerCodeReady) {
|
|
t.Errorf("status=%s CanSelect=%v", status, view.CanSelect)
|
|
}
|
|
if view.CanRecheck != (status == model.InnerCodeNeedsCheck) {
|
|
t.Errorf("status=%s CanRecheck=%v", status, view.CanRecheck)
|
|
}
|
|
}
|
|
}
|
|
|
|
func TestInnerCodeStatusOptions_覆盖所有状态(t *testing.T) {
|
|
options := InnerCodeStatusOptions()
|
|
if len(options) != 9 || options[0].Value != "" {
|
|
t.Fatalf("状态筛选项不完整: %+v", options)
|
|
}
|
|
}
|