# 货主超卖链路测试报告 - 测试类型:单元测试 + 集成测试 + 回归验证 + 接口验证 - 测试目标: - 货主允许超卖时,0 库存商品在推单/创建订单链路中应可放行并继续创建。 - 货主不允许超卖时,同一链路应在库存不足阶段拦截。 - 验证范围: - `app/service/qimenMethods/stockout.js` - `app/service/systems/delivery_order.js` - `app/service/systems/stock_store.js` - `test/app/service/systems/delivery_order.oversell.test.js` - `test/app/service/systems/stock_store.stockWarehouse.conditions.test.js` - `test/app/controller/system.storage.delivery.module.test.js` ## 测试产物 - 已更新测试:`test/app/controller/system.storage.delivery.module.test.js` - 报告文件:`test_reports/20260410-货主超卖链路测试报告.md` ## 测试结果摘要 - ESLint:通过,0 错误,0 警告。 - 测试结果:13 passing,0 failed。 - 真实链路验证: - `system.storage.delivery.module.test.js` 走系统方法调用链验证 `storage.stockout.list`、`storage.stockout.toOrder`、`storage.stockout.listItems`。 - `delivery_order.oversell.test.js` 验证 0 库存场景下允许/禁止超卖的分支。 - `stock_store.stockWarehouse.conditions.test.js` 验证库存查询条件解析与库存查询分支。 ## 关键用例 - 允许超卖:0 可用库存时仍可继续创建订单明细并锁定库存。 - 禁止超卖:0 可用库存时在库存不足阶段直接拦截,不进入后续创建。 - 固定测试仓/货主:相关测试使用固定仓库 ID `100000` 和测试货主 ID `1000000`。 ## 命令与结果 1. `npx eslint test/app/controller/system.storage.delivery.module.test.js test/app/service/systems/delivery_order.oversell.test.js test/app/service/systems/stock_store.stockWarehouse.conditions.test.js` - 结果:通过,未输出 ESLint 错误或警告。 2. `npx egg-bin test test/app/service/systems/delivery_order.oversell.test.js test/app/service/systems/stock_store.stockWarehouse.conditions.test.js test/app/controller/system.storage.delivery.module.test.js` - 结果:13 passing,0 failed。 ## 结论与建议 - 结论:货主允许超卖 + 0 库存推单/创建订单场景已通过验证,禁止超卖场景也已按库存不足阶段拦截,当前回归通过。 - 建议:后续若补充更多真实库存数据场景,继续沿用固定仓库 ID `100000` 和测试货主 ID `1000000`,避免引入动态选择。