sync: 同步 v1.0.4 开源代码并脱敏

This commit is contained in:
MiFaZhan
2026-10-29 14:52:43 +08:00
parent 32e4316ee4
commit 6893e21f07
136 changed files with 9851 additions and 436 deletions
+20 -1
View File
@@ -141,7 +141,7 @@ func TestValidateDetailDetectsMSISDNMismatch(t *testing.T) {
},
}
validateDetail(operation, detail)
if detail.Reason != "MSISDN does not match the SIM card record" {
if detail.Reason != "MSISDN与卡档案不一致" {
t.Fatalf("unexpected reason: %q", detail.Reason)
}
if detail.MSISDN != "msisdn-card" || detail.InputMSISDN != "msisdn-input" {
@@ -190,3 +190,22 @@ func (u *fakeUpstream) ChangeSimStatus(_ context.Context, input *model.SimCardSt
u.input = input
return u.response, u.responseError
}
func TestValidateDetailCollectsIndependentDiagnostics(t *testing.T) {
detail := &Detail{ICCID: "card", Authorized: true, InputMSISDN: "wrong-phone", InputIMSI: "wrong-imsi", Card: &Card{MSISDN: "phone", IMSI: "imsi"}}
validateDetail(Operation{}, detail)
want := "ICCID缺少通道标识;MSISDN与卡档案不一致;IMSI与卡档案不一致"
if detail.Reason != want {
t.Fatalf("独立校验原因丢失: got=%q want=%q", detail.Reason, want)
}
unauthorized := &Detail{ICCID: "card", InputMSISDN: "wrong", Card: &Card{MSISDN: "phone"}}
validateDetail(Operation{}, unauthorized)
if unauthorized.Reason != "ICCID不在当前操作员授权范围内" {
t.Fatalf("越权卡不应返回其他数据差异: %q", unauthorized.Reason)
}
existing := &Detail{Reason: "原始输入格式错误", Authorized: true, Card: &Card{}}
validateDetail(Operation{}, existing)
if existing.Reason != "原始输入格式错误" {
t.Fatal("原始原因被覆盖")
}
}