Skip to content

Commit

Permalink
Update React and other deps (#350)
Browse files Browse the repository at this point in the history
* Update React and other deps

* Fix build
  • Loading branch information
adamjmcgrath authored Apr 15, 2022
1 parent 88f8231 commit 887ae18
Show file tree
Hide file tree
Showing 6 changed files with 13,194 additions and 18,597 deletions.
18 changes: 11 additions & 7 deletions __tests__/helpers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,14 @@ export const createWrapper = ({
clientId = '__test_client_id__',
domain = '__test_domain__',
...opts
}: Partial<Auth0ClientOptions> = {}) => ({
children,
}: PropsWithChildren<{}>): JSX.Element => (
<Auth0Provider domain={domain} clientId={clientId} {...opts}>
{children}
</Auth0Provider>
);
}: Partial<Auth0ClientOptions> = {}) => {
return function Wrapper({
children,
}: PropsWithChildren<Record<string, unknown>>): JSX.Element {
return (
<Auth0Provider domain={domain} clientId={clientId} {...opts}>
{children}
</Auth0Provider>
);
};
};
16 changes: 12 additions & 4 deletions __tests__/with-authentication-required.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@ describe('withAuthenticationRequired', () => {
await waitFor(() =>
expect(mockClient.loginWithRedirect).not.toHaveBeenCalled()
);
expect(screen.getByText('Private')).toBeInTheDocument();
await waitFor(() =>
expect(screen.getByText('Private')).toBeInTheDocument()
);
});

it('should not allow access to claims-restricted components', async () => {
Expand Down Expand Up @@ -93,11 +95,15 @@ describe('withAuthenticationRequired', () => {
await waitFor(() =>
expect(mockClient.loginWithRedirect).not.toHaveBeenCalled()
);
expect(screen.getByText('Private')).toBeInTheDocument();
await waitFor(() =>
expect(screen.getByText('Private')).toBeInTheDocument()
);
});

it('should show a custom redirecting message', async () => {
mockClient.getUser.mockResolvedValue({ name: '__test_user__' });
mockClient.getUser.mockResolvedValue(
Promise.resolve({ name: '__test_user__' })
);
const MyComponent = (): JSX.Element => <>Private</>;
const OnRedirecting = (): JSX.Element => <>Redirecting</>;
const WrappedComponent = withAuthenticationRequired(MyComponent, {
Expand All @@ -114,7 +120,9 @@ describe('withAuthenticationRequired', () => {
await waitFor(() =>
expect(mockClient.loginWithRedirect).not.toHaveBeenCalled()
);
expect(screen.queryByText('Redirecting')).not.toBeInTheDocument();
await waitFor(() =>
expect(screen.queryByText('Redirecting')).not.toBeInTheDocument()
);
});

it('should pass additional options on to loginWithRedirect', async () => {
Expand Down
Loading

0 comments on commit 887ae18

Please sign in to comment.