Skip to content

Commit

Permalink
split a test in two
Browse files Browse the repository at this point in the history
  • Loading branch information
mairisb committed Jan 23, 2024
1 parent 9fe681b commit 52952d0
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions packages/client/src/pages/page.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,15 +66,21 @@ describe('Page', () => {
expect(navigate).not.toHaveBeenCalled();
});

it("should not redirect if the page is not auth protected, irrespective of user's authentication status", () => {
it('should not redirect if the page is not auth protected and the user is logged in', () => {
const rootStore = new RootStore();
rootStore.authStore.isAuthenticated = true;

rootStore.authStore.isAuthenticated = false;
renderWithProviders(<Page title="Test title" />, { rootStore });

expect(navigate).not.toHaveBeenCalled();
});

it('should not redirect if the page is not auth protected and the user is not logged in', () => {
const rootStore = new RootStore();
rootStore.authStore.isAuthenticated = false;

rootStore.authStore.isAuthenticated = true;
renderWithProviders(<Page title="Test title" />, { rootStore });

expect(navigate).not.toHaveBeenCalled();
});
});

0 comments on commit 52952d0

Please sign in to comment.