diff --git a/src/app/pages/AccountPage/__tests__/index.test.tsx b/src/app/pages/AccountPage/__tests__/index.test.tsx index 46bd88cf19..4c7e32d6b1 100644 --- a/src/app/pages/AccountPage/__tests__/index.test.tsx +++ b/src/app/pages/AccountPage/__tests__/index.test.tsx @@ -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' @@ -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') @@ -106,4 +106,51 @@ describe('', () => { 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() + }) })