Skip to content

Commit 41fdadc

Browse files
test: fix flaky logout test race condition (#995)
## Summary Fixes intermittent test failure in `should provide a logout method` by waiting for authentication to complete before calling logout. ## Changes Added `isAuthenticated` check to the existing `waitFor` block to ensure the provider has finished initializing before testing logout behavior. ```typescript await waitFor(() => { expect(result.current.logout).toBeInstanceOf(Function); expect(result.current.isAuthenticated).toBe(true); }); ```
1 parent c25cb38 commit 41fdadc

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

__tests__/auth-provider.test.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -491,6 +491,7 @@ describe('Auth0Provider', () => {
491491
);
492492
await waitFor(() => {
493493
expect(result.current.logout).toBeInstanceOf(Function);
494+
expect(result.current.isAuthenticated).toBe(true);
494495
});
495496
await act(() => {
496497
result.current.logout();

0 commit comments

Comments
 (0)