From 23edf3451dadcdb633aa1dfd2fb1bde6b91f1565 Mon Sep 17 00:00:00 2001 From: Javier Pedemonte Date: Tue, 23 Jul 2024 15:37:30 -0500 Subject: [PATCH] test: fix tests --- .../DocumentPreview/__tests__/DocumentPreview.test.tsx | 4 +--- .../DocumentPreview/components/PdfViewer/PdfViewer.tsx | 2 +- .../components/PdfViewer/__tests__/PdfViewer.test.tsx | 5 +---- 3 files changed, 3 insertions(+), 8 deletions(-) diff --git a/packages/discovery-react-components/src/components/DocumentPreview/__tests__/DocumentPreview.test.tsx b/packages/discovery-react-components/src/components/DocumentPreview/__tests__/DocumentPreview.test.tsx index 8c6913048..0ec80f1e9 100644 --- a/packages/discovery-react-components/src/components/DocumentPreview/__tests__/DocumentPreview.test.tsx +++ b/packages/discovery-react-components/src/components/DocumentPreview/__tests__/DocumentPreview.test.tsx @@ -252,9 +252,7 @@ describe('DocumentPreview', () => { ); // evidence PDF rendered - const elem = await screen.findByText('“Acceptance Tests” or “Acceptance Testing”', { - exact: false - }); + const elem = await screen.findByText('ART EFFECTS LIMITED'); expect(elem).toBeInTheDocument(); }, THIRTY_SECONDS diff --git a/packages/discovery-react-components/src/components/DocumentPreview/components/PdfViewer/PdfViewer.tsx b/packages/discovery-react-components/src/components/DocumentPreview/components/PdfViewer/PdfViewer.tsx index 361aa44f9..bfd729bb2 100644 --- a/packages/discovery-react-components/src/components/DocumentPreview/components/PdfViewer/PdfViewer.tsx +++ b/packages/discovery-react-components/src/components/DocumentPreview/components/PdfViewer/PdfViewer.tsx @@ -114,7 +114,7 @@ const PdfViewer = forwardRef( return promise; } catch (error) { setIsPdfRenderError?.(true); - console.error(`Failed to load pdf file: ${error}`, (error as Error).stack); + console.error(`Failed to load pdf file: ${error}`); return null; } }, [file, setIsPdfRenderError]) diff --git a/packages/discovery-react-components/src/components/DocumentPreview/components/PdfViewer/__tests__/PdfViewer.test.tsx b/packages/discovery-react-components/src/components/DocumentPreview/components/PdfViewer/__tests__/PdfViewer.test.tsx index 2411b3e2f..0599f170f 100644 --- a/packages/discovery-react-components/src/components/DocumentPreview/components/PdfViewer/__tests__/PdfViewer.test.tsx +++ b/packages/discovery-react-components/src/components/DocumentPreview/components/PdfViewer/__tests__/PdfViewer.test.tsx @@ -12,8 +12,5 @@ describe('PdfViewer', () => { await waitFor(() => expect(screen.getByText('ART EFFECTS LIMITED')).toBeVisible(), { timeout: 5000 }); - - const canvasList = document.querySelectorAll('canvas'); - expect(canvasList.length).toBe(1); - }, 30000); + }); });