Skip to content

Commit

Permalink
Update SecuredRouteForUser.test.tsx
Browse files Browse the repository at this point in the history
  • Loading branch information
duplixx authored Nov 10, 2023
1 parent 19a7f97 commit a8b5d6e
Showing 1 changed file with 13 additions and 13 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import { MemoryRouter, Route } from 'react-router-dom';
import { render, screen, waitFor } from '@testing-library/react';
import SecuredRouteForUser from './SecuredRouteForUser';
Expand All @@ -10,12 +9,17 @@ describe('SecuredRouteForUser', () => {

render(
<MemoryRouter initialEntries={['/user/organizations']}>
<SecuredRouteForUser
<Route
path="/user/organizations"
component={() => (
<div data-testid="organizations-content">
Organizations Component
</div>
render={() => (
<SecuredRouteForUser
path="/user/organizations"
component={() => (
<div data-testid="organizations-content">
Organizations Component
</div>
)}
/>
)}
/>
</MemoryRouter>
Expand All @@ -42,12 +46,8 @@ describe('SecuredRouteForUser', () => {
</MemoryRouter>
);

// Ensure that the redirect to / occurred
// waitFor(() => {
// expect(window.location.pathname).toBe('/user');
// }
await waitFor(() => {
expect(window.location.pathname).toBe('/');
});
await waitFor(() => {
expect(window.location.pathname).toBe('/');
});
});
});

0 comments on commit a8b5d6e

Please sign in to comment.