fix: add recomputeDedup mock to ProductLibrary test #1686
Reference in New Issue
Block a user
Delete Branch "fix/test-recompute-dedup-mock"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
PR #1685 added
recomputeDedupto@/api/products, but the test mock inProductLibrary.test.tsxwas missing it.The component imports
recomputeDedupand uses it viauseRecomputeDeduphook. When Vitest runs the test, the mock returnsundefinedfor this function, causing the test to crash.Solution
Added
recomputeDedup: vi.fn().mockResolvedValue({ enqueued: 0, total_scanned: 0, skipped: 0, message: "" })to thevi.mock("@/api/products", ...)block.Changes
apps/web/src/test/pages/ProductLibrary.test.tsx— addedrecomputeDedupmockVerification
npx vitest run src/test/pages/ProductLibrary.test.tsxpasses【阻塞级判定】
📊 审查概览
🔴 阻塞级问题(必须修复)
无
💡 改进建议(不阻塞合并)
无
✅ 良好实践
vi.fn().mockResolvedValue)。🤖 由 AI 代码审查机器人自动生成 | 2026-09-04 06:10:31 | 模型:
🚀 预览环境已部署
CI全绿,自动审批通过。
CI全绿,自动审批通过。
🗑️ 预览环境已清理
PR #1686 已关闭或合并,对应的预览环境已被清理。