Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: migrate more files to RTL #1014

Draft
wants to merge 55 commits into
base: data-testid
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
b3eaa54
get started with transactions
mvadari May 9, 2024
935c698
DIDDelete
mvadari May 9, 2024
d0c42d0
change imports, handle cleanup
mvadari May 9, 2024
841ba91
more cleanup
mvadari May 9, 2024
d194cb9
wrapper -> screen
mvadari May 9, 2024
780038a
use expectSimpleRowLabel
mvadari May 9, 2024
2005ea0
fix more errors
mvadari May 9, 2024
b050ec3
more fixes
mvadari May 9, 2024
fb233f0
fix linter issues
mvadari May 9, 2024
72fb3ce
fix more issues
mvadari May 9, 2024
af3a577
fix DID tests
mvadari May 9, 2024
e26efaf
fix escrow tests
mvadari May 9, 2024
4931b58
fix NFT tests
mvadari May 9, 2024
7c89927
fix offer tests
mvadari May 9, 2024
f57dbda
fix payment/paychan tests
mvadari May 9, 2024
50df175
fix stuff
mvadari May 9, 2024
e445a7a
fix signer list tests
mvadari May 9, 2024
a3da6d0
fix T tests
mvadari May 9, 2024
7533492
fix XChain tests
mvadari May 9, 2024
a5ff8a2
fix remaining issues
mvadari May 9, 2024
76ba7aa
convert more test files
mvadari May 9, 2024
afca5dc
combine notification test files
mvadari May 9, 2024
057e724
move + convert TxDetails
mvadari May 9, 2024
5bd7a5a
convert AccountTransactionTable
mvadari May 9, 2024
a18fe6d
convert Footer test
mvadari May 9, 2024
09b0a3c
convert AccountNFTTable
mvadari May 13, 2024
3147422
AMM account tests
mvadari May 13, 2024
bbc9040
fix tx table tests
mvadari May 13, 2024
4f5ee54
use userEvent instead of fireEvent
mvadari May 15, 2024
03d8a64
convert App test
mvadari May 15, 2024
8d716b9
convert Account tests
mvadari May 16, 2024
02da19e
migrate amendment test
mvadari May 16, 2024
6aa4702
convert Amendments tests
mvadari May 16, 2024
6c040ca
convert AppErrorBoundary
mvadari May 16, 2024
4bcf853
migrate CustomNetworkHome
mvadari May 16, 2024
cd27ff5
convert LanguagePicker
mvadari May 17, 2024
caee857
migrate networkpicker
mvadari May 17, 2024
2bd900e
fix tests
mvadari May 17, 2024
7845cb2
update new tests
mvadari Jul 5, 2024
e85caca
fix tests
mvadari Oct 30, 2024
5b10aff
migrate MPT tests
mvadari Oct 30, 2024
d9d2ed6
migrate AccountMPTTable
mvadari Oct 30, 2024
767f26c
migrate Banner tests
mvadari Oct 30, 2024
357b221
migrate Header tests
mvadari Oct 30, 2024
4234ffb
migrate Search tests
mvadari Oct 30, 2024
3d0e96f
[WIP] Ledger page test
mvadari Oct 30, 2024
9758827
[WIP] migrate MPTHeader tests
mvadari Oct 30, 2024
c83f775
migrate MPT
mvadari Nov 1, 2024
e5b9e02
migrate Details tests
mvadari Nov 1, 2024
ad0d18b
migrate AccountMPTRow
mvadari Nov 1, 2024
cfae2d4
migrates Settings tests
mvadari Nov 1, 2024
88a443a
[WIP] migrate network pages
mvadari Nov 1, 2024
c240083
migrate other SimpleTab tests
mvadari Nov 1, 2024
1d90262
migrate NFT Details
mvadari Nov 1, 2024
b40c207
fix some tests
mvadari Feb 5, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@
"paystrings",
"stylelint",
"svgr",
"testid",
"topojson",
"VITE",
"xchain",
Expand Down
19 changes: 19 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"@rollup/plugin-inject": "^5.0.5",
"@testing-library/jest-dom": "^5.17.0",
"@testing-library/react": "^12.1.5",
"@testing-library/user-event": "^14.5.2",
"@vitejs/plugin-react": "^4.2.1",
"@xrplf/isomorphic": "^1.0.0-beta.1",
"@xrplf/prettier-config": "^1.9.1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,11 @@ export const AMMAccountHeader = (props: { data: AmmDataType }) => {
}

return (
<div className="box account-header">
<div className="box account-header" data-testid="amm-header">
<div className="section box-header">
<div className="title">
Account ID
<div className="currency-pair">
<div className="currency-pair" data-testid="currency-pair">
<Currency
currency={balance.currency}
issuer={balance.issuer}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { mount } from 'enzyme'
import { render, screen, cleanup } from '@testing-library/react'
import { I18nextProvider } from 'react-i18next'
import { MemoryRouter } from 'react-router'
import { QueryClientProvider } from 'react-query'
Expand All @@ -10,8 +10,8 @@ import { queryClient } from '../../../../../shared/QueryClient'
describe('AMM Account Header', () => {
const TEST_ACCOUNT_ID = 'rTEST_ACCOUNT'

const createWrapper = (state: AmmDataType) =>
mount(
const renderComponent = (state: AmmDataType) =>
render(
<QueryClientProvider client={queryClient}>
<I18nextProvider i18n={i18n}>
<MemoryRouter initialEntries={[`accounts/${TEST_ACCOUNT_ID}`]}>
Expand All @@ -21,6 +21,8 @@ describe('AMM Account Header', () => {
</QueryClientProvider>,
)

afterEach(cleanup)

it('renders AMM account page', async () => {
const state: AmmDataType = {
balance: { currency: 'XRP', amount: 1000, issuer: 'hi' },
Expand All @@ -31,19 +33,17 @@ describe('AMM Account Header', () => {
language: 'en-US',
}

const wrapper = createWrapper(state)
const { container } = renderComponent(state)
await flushPromises()
wrapper.update()
expect(wrapper.find(AMMAccountHeader).length).toBe(1)
expect(wrapper.find('.box-header .title').length).toBe(1)
expect(wrapper.find('.currency-pair').length).toBe(1)
expect(wrapper.text().includes('500')).toBe(true)
expect(wrapper.text().includes('0.01%')).toBe(true)
expect(wrapper.text().includes('XRP.hi/USD.hi')).toBe(true)
expect(wrapper.text().includes('\uE9001,000')).toBe(true)
expect(wrapper.text().includes('9,000')).toBe(true)
expect(wrapper.text().includes('rTEST_ACCOUNT')).toBe(true)

wrapper.unmount()
expect(screen.queryAllByTestId('amm-header')).toHaveLength(1)
expect(screen.queryAllByText('Account ID')).toHaveLength(1)
expect(screen.getAllByTestId('currency-pair')).toHaveLength(1)
expect(container).toHaveTextContent('500')
expect(container).toHaveTextContent('0.01%')
expect(container).toHaveTextContent('XRP.hi/USD.hi')
expect(container).toHaveTextContent('\uE9001,000')
expect(container).toHaveTextContent('9,000')
expect(container).toHaveTextContent('rTEST_ACCOUNT')
})
})
Loading
Loading