mirror of
				https://github.com/paperless-ngx/paperless-ngx.git
				synced 2025-10-30 03:56:23 -05:00 
			
		
		
		
	Fix: resolve dynamic import warnings during jest tests
This commit is contained in:
		| @@ -120,3 +120,20 @@ Object.defineProperty(window, 'location', { | ||||
| 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', () => ({})) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 shamoon
					shamoon