A community-supported supercharged document management system: scan, index and archive all your documents
Python aiangulararchivingdjangodmsdocument-managementdocument-management-systemllmmachine-learningocroptical-character-recognitionpdf
Chore: resolve dynamic import warnings from pdfjs, again (#9924)
shamoon2c9e690dfb2a
diff --git a/src-ui/__mocks__/pdfjs-dist.ts b/src-ui/__mocks__/pdfjs-dist.tsnew file mode 100644index 000000000..e975a40d4--- /dev/null+++ b/src-ui/__mocks__/pdfjs-dist.ts@@ -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 {},+}diff --git a/src-ui/setup-jest.ts b/src-ui/setup-jest.tsindex 162884feb..6ac94a275 100644--- a/src-ui/setup-jest.ts+++ b/src-ui/setup-jest.ts@@ -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')