import { expect, describe, it } from "@jest/globals"; import JsPDF from "jspdf"; import { unlinkSync } from "fs"; import { setSvg2PdfHandler, addSvgFromFile, addSvgFromString, Svg2Pdf } from "../index"; const svgString = ` `; describe("adding svg", () => { describe("using exposed functions", () => { it("should add svg to pdf from string", () => { const doc = new JsPDF(); addSvgFromString(doc, svgString, { width: 100 }); }); it("should add svg to pdf from file", () => { const doc = new JsPDF(); addSvgFromFile(doc, `${__dirname}/example.svg`, { width: 100 }); }); }); describe("using Svg2Pdf class", () => { it("should add svg to pdf from string", () => { const doc = new JsPDF(); const svg2pdf = new Svg2Pdf(doc); svg2pdf.fromString(svgString, { width: 100 }); }); it("should add svg to pdf from string", () => { const doc = new JsPDF(); const svg2pdf = new Svg2Pdf(doc); svg2pdf.fromFile(`${__dirname}/example.svg`, { width: 100 }); }); }); });