mirror of
				https://github.com/paperless-ngx/paperless-ngx.git
				synced 2025-11-04 03:27:12 -05:00 
			
		
		
		
	Fix: resolve dynamic import warnings during jest tests
This commit is contained in:
		
							parent
							
								
									a9ef7ff58e
								
							
						
					
					
						commit
						5e00c1c676
					
				@ -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…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user