mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-12-07 15:25:41 +01:00
Fix: resolve dynamic import warnings during jest tests
This commit is contained in:
parent
a9ef7ff58e
commit
5e00c1c676
1 changed files with 17 additions and 0 deletions
|
|
@ -120,3 +120,20 @@ Object.defineProperty(window, 'location', {
|
||||||
HTMLCanvasElement.prototype.getContext = <
|
HTMLCanvasElement.prototype.getContext = <
|
||||||
typeof HTMLCanvasElement.prototype.getContext
|
typeof HTMLCanvasElement.prototype.getContext
|
||||||
>jest.fn()
|
>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', () => ({}))
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue