From bcfe46ff7ea25a903acd4fa2e9a7b1160cb3d6d6 Mon Sep 17 00:00:00 2001 From: Kristof Csillag Date: Thu, 29 Sep 2022 14:22:08 +0200 Subject: [PATCH] Add test case to ensure that we don't submit form with missing amount --- .../Features/SendTransaction/__tests__/index.test.tsx | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/app/pages/AccountPage/Features/SendTransaction/__tests__/index.test.tsx b/src/app/pages/AccountPage/Features/SendTransaction/__tests__/index.test.tsx index d67b493ec9..7e9c3984e2 100644 --- a/src/app/pages/AccountPage/Features/SendTransaction/__tests__/index.test.tsx +++ b/src/app/pages/AccountPage/Features/SendTransaction/__tests__/index.test.tsx @@ -20,6 +20,17 @@ describe('', () => { 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)