mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-12-06 23:05:42 +01:00
Chore: resolve dynamic import warnings from pdfjs, again (#9924)
This commit is contained in:
parent
344cc70cd5
commit
2c9e690dfb
2 changed files with 14 additions and 16 deletions
13
src-ui/__mocks__/pdfjs-dist.ts
Normal file
13
src-ui/__mocks__/pdfjs-dist.ts
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
export const getDocument = jest.fn(() => ({
|
||||
promise: Promise.resolve({ numPages: 3 }),
|
||||
}))
|
||||
|
||||
export const GlobalWorkerOptions = { workerSrc: '' }
|
||||
export const VerbosityLevel = { ERRORS: 0 }
|
||||
|
||||
globalThis.pdfjsLib = {
|
||||
getDocument,
|
||||
GlobalWorkerOptions,
|
||||
VerbosityLevel,
|
||||
AbortException: class AbortException extends Error {},
|
||||
}
|
||||
|
|
@ -121,19 +121,4 @@ HTMLCanvasElement.prototype.getContext = <
|
|||
typeof HTMLCanvasElement.prototype.getContext
|
||||
>jest.fn()
|
||||
|
||||
// pdfjs
|
||||
jest.mock('pdfjs-dist', () => ({
|
||||
getDocument: jest.fn(() => ({
|
||||
promise: Promise.resolve({ numPages: 3 }),
|
||||
})),
|
||||
GlobalWorkerOptions: { workerSrc: '' },
|
||||
VerbosityLevel: { ERRORS: 0 },
|
||||
globalThis: {
|
||||
pdfjsLib: {
|
||||
GlobalWorkerOptions: {
|
||||
workerSrc: '',
|
||||
},
|
||||
},
|
||||
},
|
||||
}))
|
||||
jest.mock('pdfjs-dist/web/pdf_viewer', () => ({}))
|
||||
jest.mock('pdfjs-dist')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue