补齐 editorProjectClient 超时契约的断言
Project CI / Repository checks (pull_request) Successful in 55s
Project CI / Backend tests (pull_request) Successful in 3m35s
Project CI / Native shell tests (pull_request) Successful in 11m25s
Project CI / Frontend tests (pull_request) Successful in 2m29s

给 saveEditorProjectLayout 与 loadEditorProject 补超时后,两条精确参数断言失败:
toHaveBeenCalledWith 要求参数完全匹配,新增第四个参数即不匹配。

把 { timeoutMs: 60_000 } 写进断言,而不是放宽成 anything()。超时是契约的一部分
——一个被 flushProjectPersistence 同步等待在提交路径上、一个在对账路径上,没有
上界会把在途占位拖过存活窗口。写死之后谁删掉它测试就会红;放宽则等于让刚建立的
上界失去看守。去掉生产代码里的两个超时,两条断言同时变红。

真正的问题是验证方式:改的是 services 下的文件,却只跑了 components 的测试。
这条链路横跨两个目录,往后验证同时覆盖两处。

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
2026-08-03 11:42:44 +00:00
parent 6fb2abfc60
commit 8d1bee9b1a
2 changed files with 15 additions and 0 deletions
@@ -188,6 +188,10 @@ describe('editorProjectClient', () => {
}),
}),
'保存图片画布工程失败',
// 中文注释:超时是契约的一部分,写死在断言里而不是放宽成 anything()。这个接口被
// flushProjectPersistence 同步等待在生成提交路径上,没有上界会把在途占位拖过存活
// 窗口;断言写死之后,谁删掉它测试就会红。
{ timeoutMs: 60_000 },
);
});
@@ -327,6 +331,9 @@ describe('editorProjectClient', () => {
'/api/editor/projects/editor-project-1',
{ method: 'GET' },
'读取图片画布工程失败',
// 中文注释:同上,超时写死在断言里。这是未知结果对账路径上的读取,挂住会让 catch
// 迟迟不结束,连带把本会话对占位的归属登记一起拖过存活窗口。
{ timeoutMs: 60_000 },
);
});