Skip to content

Commit

Permalink
Add test case to ensure that we don't submit form with missing amount
Browse files Browse the repository at this point in the history
  • Loading branch information
csillag committed Sep 30, 2022
1 parent c8e4972 commit bcfe46f
Showing 1 changed file with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,17 @@ describe('<SendTransaction />', () => {
store = configureAppStore()
})

it('should NOT dispatch sendTransaction action when amount is missing', async () => {
const spy = jest.spyOn(store, 'dispatch')
renderComponent(store)

await userEvent.type(screen.getByPlaceholderText('account.sendTransaction.enterAddress'), 'walletAddress')
await userEvent.clear(screen.getByPlaceholderText('account.sendTransaction.enterAmount'))
spy.mockClear()
await userEvent.click(screen.getByRole('button'))
expect(spy).not.toHaveBeenCalled()
})

it('should dispatch sendTransaction action on submit', async () => {
const spy = jest.spyOn(store, 'dispatch')
renderComponent(store)
Expand Down

0 comments on commit bcfe46f

Please sign in to comment.