Skip to content

Commit

Permalink
Test new variants in AccountPage
Browse files Browse the repository at this point in the history
  • Loading branch information
buberdds committed Oct 13, 2023
1 parent 6085e12 commit 9bdbf6b
Showing 1 changed file with 48 additions and 1 deletion.
49 changes: 48 additions & 1 deletion src/app/pages/AccountPage/__tests__/index.test.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { render, screen } from '@testing-library/react'
import * as React from 'react'
import { Provider, useDispatch } from 'react-redux'
import { MemoryRouter, Route, Routes } from 'react-router-dom'
import { ThemeProvider } from 'styles/theme/ThemeProvider'
Expand All @@ -9,6 +8,7 @@ import { AccountPage } from '..'
import { AccountDetails } from '../Features/AccountDetails'
import { DeepPartialRootState } from 'types/RootState'
import { stakingActions } from 'app/state/staking'
import { PersistState } from 'app/state/persist/types'
import { WalletErrors } from 'types/errors'

jest.unmock('react-i18next')
Expand Down Expand Up @@ -106,4 +106,51 @@ describe('<AccountPage />', () => {
const balance = await screen.findByTestId('account-balance-total')
expect(balance).toHaveTextContent('1,563,114,365,108.133940743')
})

it('should render edit address variant', async () => {
store = configureAppStore({
...store.getState(),
account: {
...store.getState().account,
available: 1563114365108133939632n.toString(),
},
persist: {
hasPersistedProfiles: true,
stringifiedEncryptionKey: 'unlockedProfile',
} as PersistState,
})
renderPage(store, ['/account/oasis1qz0k5q8vjqvu4s4nwxyj406ylnflkc4vrcjghuwk'])
expect(screen.getByText('oasis1 qz0k 5q8v jqvu 4s4n wxyj 406y lnfl kc4v rcjg huwk')).toBeInTheDocument()
expect(screen.getByTestId('editable-address-edit-button')).toBeInTheDocument()
})

it('should render edit name variant', async () => {
store = configureAppStore({
...store.getState(),
account: {
...store.getState().account,
available: 1563114365108133939632n.toString(),
},
persist: {
hasPersistedProfiles: true,
stringifiedEncryptionKey: 'unlockedProfile',
} as PersistState,
wallet: {
selectedWallet: 'oasis1qz0k5q8vjqvu4s4nwxyj406ylnflkc4vrcjghuwk',
wallets: {
oasis1qz0k5q8vjqvu4s4nwxyj406ylnflkc4vrcjghuwk: {
...store.getState().wallet.wallets.oasis1qz0k5q8vjqvu4s4nwxyj406ylnflkc4vrcjghuwk,
address: 'oasis1qz0k5q8vjqvu4s4nwxyj406ylnflkc4vrcjghuwk',
name: 'My Wallet',
},
},
},
})
renderPage(store, ['/account/oasis1qz0k5q8vjqvu4s4nwxyj406ylnflkc4vrcjghuwk'])
expect(
screen.queryByText('oasis1 qz0k 5q8v jqvu 4s4n wxyj 406y lnfl kc4v rcjg huwk'),
).not.toBeInTheDocument()
expect(screen.getByText('My Wallet')).toBeInTheDocument()
expect(screen.getByTestId('editable-name-edit-button')).toBeInTheDocument()
})
})

0 comments on commit 9bdbf6b

Please sign in to comment.