mirror of
https://github.com/modelstudioai/cli.git
synced 2026-09-14 19:49:23 +08:00
test(e2e): 修正知识库删除测试中文件名匹配逻辑
- 移除未使用的完整文件名变量 - 使用文件名主干(去掉扩展名)进行文档匹配判断 - 更新断言提示信息以反映主干文件名匹配 - 提升测试对文档名称匹配的准确性与鲁棒性
This commit is contained in:
@@ -168,7 +168,6 @@ describe.skipIf(!isKbAdminE2EReady())("e2e: knowledge kb 写链路 (live, 自清
|
||||
// 2.8) Verify the imported file is actually visible in the KB — final_status
|
||||
// COMPLETED only proves the job finished; an independent doc list query
|
||||
// confirms the file was registered as a document in the index
|
||||
const importedFileName = basename(importFilePath);
|
||||
const docListRun = await runCommandE2e(KNOWLEDGE_KB_DELETE_ROUTES, [
|
||||
"knowledge",
|
||||
"doc",
|
||||
@@ -184,10 +183,12 @@ describe.skipIf(!isKbAdminE2EReady())("e2e: knowledge kb 写链路 (live, 自清
|
||||
const docListData = parseStdoutJson<{
|
||||
data?: { rows?: Array<{ doc_name?: string; status?: string }> };
|
||||
}>(docListRun.stdout);
|
||||
// doc_name drops the file extension (e.g. "foo.md" → "foo"); match by stem
|
||||
const importedFileStem = basename(importFilePath).replace(/\.[^.]+$/, "");
|
||||
const importedDoc = docListData.data?.rows?.find((row) =>
|
||||
row.doc_name?.includes(importedFileName),
|
||||
row.doc_name?.includes(importedFileStem),
|
||||
);
|
||||
expect(importedDoc, `expected doc list to contain file "${importedFileName}"`).toBeTruthy();
|
||||
expect(importedDoc, `expected doc list to contain file "${importedFileStem}"`).toBeTruthy();
|
||||
|
||||
// 3) Delete the base (--yes non-interactive; deleteKbWithRetry retries on
|
||||
// IndexStatusError: readiness can lag briefly even after the import completes)
|
||||
|
||||
Reference in New Issue
Block a user