test: Word 导出断言只统计数据文件,忽略 zip 目录条目

This commit is contained in:
1288893
2026-11-28 20:00:33 +08:00
committed by margrop
parent 3812d3a03a
commit 91016f5bda

View File

@@ -200,7 +200,8 @@ describe("buildDocxParagraphs", () => {
];
const blob = await buildQuestionsDocx(withFigureOnly, { includeImages: false });
const entries = unzipSync(new Uint8Array(await blob.arrayBuffer()));
const mediaFiles = Object.keys(entries).filter((n) => n.startsWith("word/media/"));
// 解压结果里有 "word/media/" 目录条目,只统计真正的图片文件
const mediaFiles = Object.keys(entries).filter((n) => n.startsWith("word/media/") && !n.endsWith("/"));
expect(mediaFiles).toHaveLength(1);
}, 20000);
});