Skip to content

Commit

Permalink
fix: handle optional messages in networkActivity reducer and update t…
Browse files Browse the repository at this point in the history
…est case for ReauthDialog
  • Loading branch information
hervedombya committed Jan 16, 2025
1 parent 6f112ba commit 673b122
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/react/reducers/networkActivity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export default function networkActivity(
return {
...state,
counter: Math.max(state.counter - 1, 0),
messages: state.messages.shift(),
messages: state.messages?.shift(),
};

case 'NETWORK_AUTH_FAILURE':
Expand Down
3 changes: 2 additions & 1 deletion src/react/ui-elements/__tests__/ReauthDialog.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ describe('class <ReauthDialog />', () => {
});
expect(screen.queryByText(modalTitle)).not.toBeInTheDocument();
});
it.only('should not render the ReauthDialog component if the network activity authFailure is false even if error is of type byAuth', () => {
it('should not render the ReauthDialog component if the network activity authFailure is false even if error is of type byAuth', () => {
renderWithRouterMatch(<ReauthDialog />, undefined, {
networkActivity: {
authFailure: false,
Expand Down Expand Up @@ -86,6 +86,7 @@ describe('class <ReauthDialog />', () => {
},
},
});

expect(screen.getByText(modalTitle)).toBeInTheDocument();
expect(screen.getByText(defaultMessage)).toBeInTheDocument();
});
Expand Down

0 comments on commit 673b122

Please sign in to comment.