Skip to content

Commit

Permalink
add test coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
alissacrane-cb committed Aug 14, 2024
1 parent 85ec2cb commit 62c78f8
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/wallet/components/WalletBottomSheet.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -101,4 +101,22 @@ describe('WalletBottomSheet', () => {

expect(setIsOpenMock).toHaveBeenCalledWith(false);
});

it('closes the bottom sheet when Escape key is pressed', () => {
const setIsOpenMock = vi.fn();
useAccountMock.mockReturnValue({ address: '0x123' });
useWalletContextMock.mockReturnValue({
isOpen: true,
setIsOpen: setIsOpenMock,
});

render(<WalletBottomSheet>Content</WalletBottomSheet>);

fireEvent.keyDown(screen.getByRole('button'), {
key: 'Escape',
code: 'Escape',
});

expect(setIsOpenMock).toHaveBeenCalledWith(false);
});
});

0 comments on commit 62c78f8

Please sign in to comment.