Skip to content

Commit

Permalink
add duplicate wallet name error message test
Browse files Browse the repository at this point in the history
  • Loading branch information
Zachary Johnson committed Feb 8, 2024
1 parent 4096c20 commit 9ddadf5
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/components/CreateWallet.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,26 @@ describe('<CreateWallet />', () => {
expect(await screen.findByText('create_wallet.feedback_invalid_password_confirm')).toBeVisible()
})

it('should show validation message to user if duplicate wallet name', async () => {
;(apiMock.getWalletAll as jest.Mock).mockReturnValue(
Promise.resolve({
ok: true,
json: () => Promise.resolve({ wallets: [`${testWalletName}.jmdat`] }),
}),
)
setup({})

expect(await screen.queryByText('create_wallet.feedback_wallet_name_already_exists')).not.toBeInTheDocument()

await user.type(screen.getByPlaceholderText('create_wallet.placeholder_wallet_name'), testWalletName)
await user.type(screen.getByPlaceholderText('create_wallet.placeholder_password'), testWalletPassword)
await user.type(screen.getByPlaceholderText('create_wallet.placeholder_password_confirm'), testWalletPassword)

await user.click(screen.getByText('create_wallet.button_create'))

expect(await screen.findByText('create_wallet.feedback_wallet_name_already_exists')).toBeVisible()
})

it('should not submit form if wallet name contains invalid characters', async () => {
setup({})

Expand Down

0 comments on commit 9ddadf5

Please sign in to comment.