48 lines
1.5 KiB
Go
48 lines
1.5 KiB
Go
package unsub
|
|
|
|
import (
|
|
"context"
|
|
"testing"
|
|
|
|
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/library/batchimport"
|
|
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model"
|
|
)
|
|
|
|
func TestProcessorConfigTemplateHeaders(t *testing.T) {
|
|
config := NewProcessor().Config()
|
|
expected := []string{"ICCID", "MSISDN", "IMSI"}
|
|
if len(config.TemplateHeaders) != len(expected) {
|
|
t.Fatalf("unexpected template header count: got %d want %d", len(config.TemplateHeaders), len(expected))
|
|
}
|
|
for i, header := range expected {
|
|
if config.TemplateHeaders[i] != header {
|
|
t.Fatalf("unexpected template header at %d: got %q want %q", i, config.TemplateHeaders[i], header)
|
|
}
|
|
}
|
|
}
|
|
|
|
func TestBuildBatchInfoExcelDoesNotIncludeRemarkOrSourceBatchNo(t *testing.T) {
|
|
processor := NewProcessor()
|
|
info := processor.BuildBatchInfo(context.Background(), batchimport.SubmitRequest{
|
|
BizParams: &model.TSimCardUnsubExcelSubmitParam{},
|
|
}, nil, nil, nil, 0)
|
|
|
|
if info.Get("remark").String() != "" {
|
|
t.Fatalf("excel batch info should not include remark")
|
|
}
|
|
if info.Get("sourceBatchNo").String() != "" {
|
|
t.Fatalf("excel batch info should not include sourceBatchNo")
|
|
}
|
|
}
|
|
|
|
func TestBuildBatchInfoInputKeepsRemark(t *testing.T) {
|
|
processor := NewProcessor()
|
|
info := processor.BuildBatchInfo(context.Background(), batchimport.SubmitRequest{
|
|
BizParams: &model.TSimCardUnsubInputSubmitParam{Remark: " note "},
|
|
}, nil, nil, nil, 0)
|
|
|
|
if got := info.Get("remark").String(); got != "note" {
|
|
t.Fatalf("unexpected remark: got %q", got)
|
|
}
|
|
}
|