Skip to content

Commit

Permalink
debug tests
Browse files Browse the repository at this point in the history
  • Loading branch information
codyzu committed Jul 25, 2023
1 parent 3550f17 commit a4861f0
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/components/pdf/__mocks__/Pdf.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,11 @@ export default function Pdf({
const dataUri = useMemo(() => (file as MagicFile).getDataUri(), [file]);
const onPageRenderedMockedToBlob = useCallback(
(canvas: HTMLCanvasElement) => {
console.log('CANVAS MOCK', pageIndex, pages);
// The mocked canvas toBlob doesn't do anything by default
// In our tests, we will call the callback with pre-rendered page image
vi.mocked(canvas.toBlob).mockImplementation((callback: BlobCallback) => {
console.log('CANVAS MOCK CALLING CALLBACK', pageIndex, pages);
callback(pages[pageIndex] as unknown as Blob);
});
onPageRendered(canvas);
Expand Down

0 comments on commit a4861f0

Please sign in to comment.