test: tighten document extractor artifact assertion · openclaw/openclaw@f31a671
shakkernerd
·
2026-05-11
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -21,22 +21,31 @@ describe("loadBundledDocumentExtractorEntriesFromDir", () => {
|
21 | 21 | }); |
22 | 22 | |
23 | 23 | it("isolates a throwing factory when another extractor factory succeeds", () => { |
| 24 | +const extract = vi.fn(); |
24 | 25 | publicArtifactModule.createBrokenDocumentExtractor = () => { |
25 | 26 | throw new Error("native probe failed"); |
26 | 27 | }; |
27 | 28 | publicArtifactModule.createPdfDocumentExtractor = () => ({ |
28 | 29 | id: "pdf", |
29 | 30 | label: "PDF", |
30 | 31 | mimeTypes: ["application/pdf"], |
31 | | -extract: vi.fn(), |
| 32 | + extract, |
32 | 33 | }); |
33 | 34 | |
34 | 35 | expect( |
35 | 36 | loadBundledDocumentExtractorEntriesFromDir({ |
36 | 37 | dirName: "demo", |
37 | 38 | pluginId: "demo", |
38 | 39 | }), |
39 | | -).toMatchObject([{ id: "pdf", pluginId: "demo" }]); |
| 40 | +).toStrictEqual([ |
| 41 | +{ |
| 42 | +id: "pdf", |
| 43 | +label: "PDF", |
| 44 | +mimeTypes: ["application/pdf"], |
| 45 | + extract, |
| 46 | +pluginId: "demo", |
| 47 | +}, |
| 48 | +]); |
40 | 49 | }); |
41 | 50 | |
42 | 51 | it("surfaces initialization failure when every matching factory throws", () => { |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。