Skip to content

Commit

Permalink
test: add tests for valid input formats
Browse files Browse the repository at this point in the history
  • Loading branch information
mojoaxel committed Jan 27, 2024
1 parent 00a3777 commit c7dc5d0
Show file tree
Hide file tree
Showing 7 changed files with 357 additions and 175 deletions.
6 changes: 1 addition & 5 deletions PDFMergerBase.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { PDFDocument } from 'pdf-lib'

import { parsePagesString } from './parsePagesString'
import { parsePagesString } from './parsePagesString.js'

/**
* @typedef {Object} Metadata
Expand All @@ -14,10 +14,6 @@ import { parsePagesString } from './parsePagesString'
* @typedef {Uint8Array | ArrayBuffer | Blob | URL} PdfInput
*/

/**
* @class PDFMergerBase
* @classdesc Base class for PDFMerger
*/
export default class PDFMergerBase {
/**
* The internal pdf-lib document.
Expand Down
109 changes: 109 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
"pdf-lib": "^1.17.1"
},
"devDependencies": {
"cross-blob": "^3.0.2",
"fs-extra": "^11.2.0",
"jest": "^29.7.0",
"jest-environment-jsdom": "^29.7.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ async function readFixtureAsUint8Array (file) {
// Note: The browser tests differ from standard as all files are expected
// to be generated or fetched before being passed into the merger.
// For testing, they are retrieved with fs.ReadFile() and then passed in.
describe('PDFMerger', () => {
describe('PDFMerger for browser', () => {
beforeAll(async () => {
await fs.ensureDir(TMP_DIR)
fileA = await readFixtureAsUint8Array('Testfile_A.pdf')
Expand Down
Loading

0 comments on commit c7dc5d0

Please sign in to comment.