mirror of
https://github.com/AmruthPillai/Reactive-Resume.git
synced 2026-08-25 15:52:21 +10:00
fix: typecheck
This commit is contained in:
@@ -6,7 +6,6 @@ import { sampleResumeData } from "@reactive-resume/schema/resume/sample";
|
||||
|
||||
const pdfViewerMock = vi.hoisted(() => {
|
||||
const pdfDocument = {
|
||||
destroy: vi.fn(),
|
||||
numPages: 1,
|
||||
};
|
||||
|
||||
@@ -93,7 +92,6 @@ beforeEach(() => {
|
||||
pdfViewerMock.createResumePdfBlob.mockClear();
|
||||
pdfViewerMock.getDocument.mockClear();
|
||||
pdfViewerMock.loadingTask.destroy.mockClear();
|
||||
pdfViewerMock.pdfDocument.destroy.mockClear();
|
||||
});
|
||||
|
||||
describe("PdfViewer", () => {
|
||||
@@ -113,7 +111,6 @@ describe("PdfViewer", () => {
|
||||
|
||||
expect(abortSignal?.aborted).toBe(true);
|
||||
expect(viewer.setDocument).toHaveBeenCalledWith(null);
|
||||
expect(pdfViewerMock.pdfDocument.destroy).toHaveBeenCalledTimes(1);
|
||||
expect(pdfViewerMock.loadingTask.destroy).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -168,7 +168,7 @@ export function PdfViewer({ className, data }: PdfViewerProps) {
|
||||
const nextDocument = await loadingTask.promise;
|
||||
|
||||
if (isCancelled) {
|
||||
void nextDocument.destroy();
|
||||
void loadingTask.destroy();
|
||||
} else {
|
||||
pdfDocument = nextDocument;
|
||||
const pdfViewerOptions = {
|
||||
@@ -208,7 +208,6 @@ export function PdfViewer({ className, data }: PdfViewerProps) {
|
||||
window.cancelAnimationFrame(animationFrameId);
|
||||
resizeObserver?.disconnect();
|
||||
if (pdfViewer) clearPdfViewerDocument(pdfViewer);
|
||||
void pdfDocument?.destroy();
|
||||
void loadingTask?.destroy();
|
||||
viewer.replaceChildren();
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user