瀏覽代碼

✅ test(payment): 增强支付API集成测试用例

- 添加totalAmount字段验证,确保金额正确返回
- 验证支付响应中新增的金额字段存在性
- 确认totalAmount值符合预期(20000)
yourname 3 月之前
父節點
當前提交
580357cdcf
共有 1 個文件被更改,包括 3 次插入0 次删除
  1. 3 0
      web/tests/integration/server/payment.integration.test.ts

+ 3 - 0
web/tests/integration/server/payment.integration.test.ts

@@ -114,8 +114,10 @@ describe('支付API集成测试', () => {
         expect(result).toHaveProperty('package');
         expect(result).toHaveProperty('signType');
         expect(result).toHaveProperty('paySign');
+        expect(result).toHaveProperty('totalAmount'); // 验证新增的金额字段
         expect(result.paymentId).toBeDefined();
         expect(result.paymentId).not.toBe('undefined');
+        expect(result.totalAmount).toBe(20000); // 验证金额正确返回
       }
     });
 
@@ -377,6 +379,7 @@ describe('支付API集成测试', () => {
         expect(result.package).toContain('prepay_id=');
         expect(result.signType).toBe('RSA');
         expect(result.paySign).toBeTruthy(); // 签名应该存在
+        expect(result.totalAmount).toBe(20000); // 验证金额字段正确返回
       }
     });
   });