Skip to content
Snippets Groups Projects
index.test.ts 504 B
import fs from "fs";
import path from "path";
import { describe, it, expect } from "@jest/globals";
import PDFparser from "../src/pdfParser";

describe("PDF parser", () => {
  it("should return pdf document metadata", async () => {
    const file = fs.readFileSync(path.resolve(__dirname, "./example.pdf"));

    const parser = new PDFparser(file);

    const actual = await parser.getPDFMeta();

    expect(actual.pages).toEqual(1);
    expect(actual.title).toEqual("PDF Digital Signatures");
  });
});