Skip to content

Commit

Permalink
Add missing linkService in DocumentContext in unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
wojtekmaj committed Feb 1, 2024
1 parent aa8c564 commit cf5327b
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions packages/react-pdf/src/Page.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ describe('Page', () => {
const { func: onLoadSuccess, promise: onLoadSuccessPromise } = makeAsyncCallback();

renderWithContext(<Page onLoadSuccess={onLoadSuccess} pageIndex={1} pageNumber={1} />, {
linkService,
pdf,
});

Expand All @@ -180,7 +181,11 @@ describe('Page', () => {
it('calls registerPage when loaded a page', async () => {
const { func: registerPage, promise: registerPagePromise } = makeAsyncCallback();

renderWithContext(<Page pageIndex={0} />, { pdf, registerPage });
renderWithContext(<Page pageIndex={0} />, {
linkService,
pdf,
registerPage,
});

expect.assertions(1);

Expand All @@ -190,7 +195,11 @@ describe('Page', () => {
it('calls unregisterPage on unmount', async () => {
const { func: unregisterPage, promise: nuregisterPagePromise } = makeAsyncCallback();

const { unmount } = renderWithContext(<Page pageIndex={0} />, { pdf, unregisterPage });
const { unmount } = renderWithContext(<Page pageIndex={0} />, {
linkService,
pdf,
unregisterPage,
});

unmount();

Expand All @@ -203,6 +212,7 @@ describe('Page', () => {
const { func: onLoadSuccess, promise: onLoadSuccessPromise } = makeAsyncCallback();

const { rerender } = renderWithContext(<Page onLoadSuccess={onLoadSuccess} pageIndex={0} />, {
linkService,
pdf,
});

Expand All @@ -224,6 +234,7 @@ describe('Page', () => {
const { func: onLoadSuccess, promise: onLoadSuccessPromise } = makeAsyncCallback();

const { rerender } = renderWithContext(<Page onLoadSuccess={onLoadSuccess} pageIndex={0} />, {
linkService,
pdf,
});

Expand Down Expand Up @@ -255,6 +266,7 @@ describe('Page', () => {
const className = 'testClassName';

const { container } = renderWithContext(<Page className={className} pageIndex={0} />, {
linkService,
pdf,
});

Expand Down Expand Up @@ -370,6 +382,7 @@ describe('Page', () => {

it('renders custom loading message when loading a page and loading prop is given as a function', async () => {
const { container } = renderWithContext(<Page loading={() => 'Loading'} pageIndex={0} />, {
linkService,
pdf,
});

Expand All @@ -383,6 +396,7 @@ describe('Page', () => {
const { func: onLoadSuccess, promise: onLoadSuccessPromise } = makeAsyncCallback();

renderWithContext(<Page onLoadSuccess={onLoadSuccess} pageIndex={1} pageNumber={1} />, {
linkService,
pdf,
});

Expand Down Expand Up @@ -856,6 +870,7 @@ describe('Page', () => {
renderWithContext(
<Page onLoadSuccess={onLoadSuccess} pageIndex={0} scale={scale} width={width} />,
{
linkService,
pdf,
},
);
Expand All @@ -873,6 +888,7 @@ describe('Page', () => {
const height = 850;

renderWithContext(<Page height={height} onLoadSuccess={onLoadSuccess} pageIndex={0} />, {
linkService,
pdf,
});

Expand All @@ -892,6 +908,7 @@ describe('Page', () => {
renderWithContext(
<Page height={height} onLoadSuccess={onLoadSuccess} pageIndex={0} scale={scale} />,
{
linkService,
pdf,
},
);
Expand All @@ -912,6 +929,7 @@ describe('Page', () => {
renderWithContext(
<Page height={height} onLoadSuccess={onLoadSuccess} pageIndex={0} width={width} />,
{
linkService,
pdf,
},
);
Expand Down

0 comments on commit cf5327b

Please sign in to comment.