重构:完成架构一致性整改与生命周期收口
This commit is contained in:
1 parent
55904cc409
commit
9eb6be2875
344 files changed
+15961
-13926
No files matched your search
@@ -4,9 +4,9 @@ import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
// TestOrderStatusMap 负责Test订单状态Map相关处理。
|
||||
// TestOrderStatusMap 封装Test订单状态Map业务协调。
|
||||
func TestOrderStatusMap(t *testing.T) {
|
||||
// cases 保存cases,供当前处理流程使用
|
||||
// cases 用于本次流程后续判断的cases
|
||||
cases := []struct {
|
||||
code int
|
||||
expect string
|
||||
@@ -17,18 +17,18 @@ func TestOrderStatusMap(t *testing.T) {
|
||||
}
|
||||
// c 表示当前遍历过程中的c
|
||||
for _, c := range cases {
|
||||
if // s、ok 保存s、ok,供当前处理流程使用
|
||||
if // s、ok 用于本次流程后续判断的s、ok
|
||||
s, ok := orderStatusMap[c.code]; !ok || s != c.expect {
|
||||
t.Errorf("orderStatusMap[%d] = %q, want %q", c.code, s, c.expect)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// TestParseAPIResponseStatusCode 负责TestParseAPI响应状态Code相关处理。
|
||||
// TestParseAPIResponseStatusCode 封装TestParseAPI响应状态Code业务协调。
|
||||
func TestParseAPIResponseStatusCode(t *testing.T) {
|
||||
// od 保存od,供当前处理流程使用
|
||||
// od 用于本次流程后续判断的od
|
||||
od := &OrderDetail{}
|
||||
// data 保存数据,供当前处理流程使用
|
||||
// data 用于本次流程后续判断的数据
|
||||
data := map[string]any{
|
||||
"utArgs": map[string]any{"orderStatus": float64(2)},
|
||||
}
|
||||
@@ -38,11 +38,11 @@ func TestParseAPIResponseStatusCode(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
// TestParseAPIResponseAmountFromComponentData 负责TestParseAPI响应AmountFromComponent数据相关处理。
|
||||
// TestParseAPIResponseAmountFromComponentData 封装TestParseAPI响应AmountFromComponent数据业务协调。
|
||||
func TestParseAPIResponseAmountFromComponentData(t *testing.T) {
|
||||
// od 保存od,供当前处理流程使用
|
||||
// od 用于本次流程后续判断的od
|
||||
od := &OrderDetail{}
|
||||
// data 保存数据,供当前处理流程使用
|
||||
// data 用于本次流程后续判断的数据
|
||||
data := map[string]any{
|
||||
"components": []any{
|
||||
map[string]any{
|
||||
@@ -61,9 +61,9 @@ func TestParseAPIResponseAmountFromComponentData(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
// TestExtractPaidAmountFromText 负责TestExtractPaidAmountFrom文本相关处理。
|
||||
// TestExtractPaidAmountFromText 封装TestExtractPaidAmountFrom文本业务协调。
|
||||
func TestExtractPaidAmountFromText(t *testing.T) {
|
||||
// cases 保存cases,供当前处理流程使用
|
||||
// cases 用于本次流程后续判断的cases
|
||||
cases := map[string]string{
|
||||
"商品标价\n¥99.00\n实付款 ¥0.88\n交易成功": "0.88",
|
||||
"订单信息\n实付金额\n¥12.50\n订单编号": "12.50",
|
||||
@@ -72,7 +72,7 @@ func TestExtractPaidAmountFromText(t *testing.T) {
|
||||
}
|
||||
// input、want 表示当前遍历过程中的input、want
|
||||
for input, want := range cases {
|
||||
if // got 保存got,供当前处理流程使用
|
||||
if // got 用于本次流程后续判断的got
|
||||
got := extractPaidAmountFromText(input); got != want {
|
||||
t.Errorf("extractPaidAmountFromText(%q)=%q want %q", input, got, want)
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user