Skip to content

Commit 219d8be

Browse files
committed
test(e2e): 修正知识库删除测试中文件名匹配逻辑
- 移除未使用的完整文件名变量 - 使用文件名主干(去掉扩展名)进行文档匹配判断 - 更新断言提示信息以反映主干文件名匹配 - 提升测试对文档名称匹配的准确性与鲁棒性
1 parent ab766d4 commit 219d8be

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

packages/commands/tests/e2e/knowledge/knowledge-kb-delete.e2e.test.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,6 @@ describe.skipIf(!isKbAdminE2EReady())("e2e: knowledge kb 写链路 (live, 自清
168168
// 2.8) Verify the imported file is actually visible in the KB — final_status
169169
// COMPLETED only proves the job finished; an independent doc list query
170170
// confirms the file was registered as a document in the index
171-
const importedFileName = basename(importFilePath);
172171
const docListRun = await runCommandE2e(KNOWLEDGE_KB_DELETE_ROUTES, [
173172
"knowledge",
174173
"doc",
@@ -184,10 +183,12 @@ describe.skipIf(!isKbAdminE2EReady())("e2e: knowledge kb 写链路 (live, 自清
184183
const docListData = parseStdoutJson<{
185184
data?: { rows?: Array<{ doc_name?: string; status?: string }> };
186185
}>(docListRun.stdout);
186+
// doc_name drops the file extension (e.g. "foo.md" → "foo"); match by stem
187+
const importedFileStem = basename(importFilePath).replace(/\.[^.]+$/, "");
187188
const importedDoc = docListData.data?.rows?.find((row) =>
188-
row.doc_name?.includes(importedFileName),
189+
row.doc_name?.includes(importedFileStem),
189190
);
190-
expect(importedDoc, `expected doc list to contain file "${importedFileName}"`).toBeTruthy();
191+
expect(importedDoc, `expected doc list to contain file "${importedFileStem}"`).toBeTruthy();
191192

192193
// 3) Delete the base (--yes non-interactive; deleteKbWithRetry retries on
193194
// IndexStatusError: readiness can lag briefly even after the import completes)

0 commit comments

Comments
 (0)