fix: 修复测试套件质量审查问题——act环境、正则匹配、mock排序、超时设置

This commit is contained in:
2026-06-08 14:13:45 +08:00
parent 74266dc5cc
commit d02abce58d
11 changed files with 204 additions and 179 deletions

View File

@@ -54,6 +54,12 @@ function setupFetchMock() {
if (call.url.includes("/models")) {
return jsonResponse({ items: [TEXT_MODEL], total: 1 });
}
if (call.url.includes("/messages")) {
return jsonResponse({ items: [], total: 0 });
}
if (call.method === "GET" && /\/conversations\/conv-/.exec(call.url)) {
return jsonResponse({ conversation: CONVERSATION });
}
if (call.url.includes("/conversations") && call.method === "GET") {
return jsonResponse({ items: [CONVERSATION], page: 1, pageSize: 200, total: 1 });
}
@@ -63,12 +69,6 @@ function setupFetchMock() {
if (call.method === "DELETE" && call.url.includes("/conversations/")) {
return new Response(null, { status: 204 });
}
if (call.url.includes("/messages")) {
return jsonResponse({ items: [], total: 0 });
}
if (/\/conversations\/conv-1$/.exec(call.url)) {
return jsonResponse({ conversation: CONVERSATION });
}
return jsonResponse({ error: "not found" }, { status: 404 });
});
}
@@ -143,15 +143,18 @@ describe("ChatPage", () => {
if (call.url.includes("/models")) {
return jsonResponse({ items: [TEXT_MODEL], total: 1 });
}
if (call.url.includes("/messages")) {
return jsonResponse({ items: [], total: 0 });
}
if (call.method === "GET" && /\/conversations\/conv-/.exec(call.url)) {
return jsonResponse({ conversation: CONVERSATION });
}
if (call.url.includes("/conversations") && call.method === "GET") {
if (deleted) {
return jsonResponse({ items: [], page: 1, pageSize: 200, total: 0 });
}
return jsonResponse({ items: [CONVERSATION], page: 1, pageSize: 200, total: 1 });
}
if (call.url.includes("/messages")) {
return jsonResponse({ items: [], total: 0 });
}
return jsonResponse({ error: "not found" }, { status: 404 });
});