First implementation of Plimi
This commit is contained in:
32
src/tools/pdf-merger/run.test.ts
Normal file
32
src/tools/pdf-merger/run.test.ts
Normal file
@@ -0,0 +1,32 @@
|
||||
import { describe, it, expect, vi } from "vitest";
|
||||
import { pdfMergerPlugin } from "./index";
|
||||
import { runPdfMerger } from "./run";
|
||||
import type { ToolContext } from "../../core/plugins/plugin-types";
|
||||
|
||||
describe("PDF Merger Plugin", () => {
|
||||
const mockContext: ToolContext = {
|
||||
signal: new AbortController().signal,
|
||||
reportProgress: vi.fn(),
|
||||
logger: {
|
||||
info: vi.fn(),
|
||||
warn: vi.fn(),
|
||||
error: vi.fn(),
|
||||
},
|
||||
};
|
||||
|
||||
it("should have correct manifest", () => {
|
||||
expect(pdfMergerPlugin.manifest.id).toBe("pdf-merger");
|
||||
expect(pdfMergerPlugin.manifest.input.type).toBe("files");
|
||||
expect(pdfMergerPlugin.manifest.output.type).toBe("files");
|
||||
});
|
||||
|
||||
it("should have run function", () => {
|
||||
expect(pdfMergerPlugin.run).toBeDefined();
|
||||
});
|
||||
|
||||
it("should throw error if no files provided", async () => {
|
||||
await expect(
|
||||
runPdfMerger({ files: [] }, {}, mockContext)
|
||||
).rejects.toThrow("No files provided for merging.");
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user