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
d03a82d
replace more
mvadari Oct 30, 2024
2e951b3
get started with transactions
mvadari May 9, 2024
84ecfa5
DIDDelete
mvadari May 9, 2024
878ac62
change imports, handle cleanup
mvadari May 9, 2024
e9f47fe
more cleanup
mvadari May 9, 2024
fd8d50c
wrapper -> screen
mvadari May 9, 2024
5169134
use expectSimpleRowLabel
mvadari May 9, 2024
2cd65cc
fix more errors
mvadari May 9, 2024
b16bf04
more fixes
mvadari May 9, 2024
5979986
fix linter issues
mvadari May 9, 2024
f39ac04
fix more issues
mvadari May 9, 2024
56468f7
fix DID tests
mvadari May 9, 2024
70a4e44
fix escrow tests
mvadari May 9, 2024
09b0865
fix NFT tests
mvadari May 9, 2024
6c7b362
fix offer tests
mvadari May 9, 2024
e1ca0b4
fix payment/paychan tests
mvadari May 9, 2024
b580a2a
fix stuff
mvadari May 9, 2024
c3a97bd
fix signer list tests
mvadari May 9, 2024
8712366
fix T tests
mvadari May 9, 2024
a039281
fix XChain tests
mvadari May 9, 2024
10b1bdb
fix remaining issues
mvadari May 9, 2024
3bc6611
convert more test files
mvadari May 9, 2024
334d076
combine notification test files
mvadari May 9, 2024
aa859f3
move + convert TxDetails
mvadari May 9, 2024
8923ea8
convert AccountTransactionTable
mvadari May 9, 2024
a983ea3
convert Footer test
mvadari May 9, 2024
857d3fc
convert AccountNFTTable
mvadari May 13, 2024
d2db2ac
AMM account tests
mvadari May 13, 2024
17c313b
fix tx table tests
mvadari May 13, 2024
36ba356
use userEvent instead of fireEvent
mvadari May 15, 2024
df340db
convert App test
mvadari May 15, 2024
135795c
convert Account tests
mvadari May 16, 2024
e57eb42
migrate amendment test
mvadari May 16, 2024
0e2ab17
convert Amendments tests
mvadari May 16, 2024
5167ef6
convert AppErrorBoundary
mvadari May 16, 2024
878d995
migrate CustomNetworkHome
mvadari May 16, 2024
626e4b6
convert LanguagePicker
mvadari May 17, 2024
6d83790
migrate networkpicker
mvadari May 17, 2024
ff5c1e6
fix tests
mvadari May 17, 2024
b70023a
update new tests
mvadari Jul 5, 2024
d2cd222
fix tests
mvadari Oct 30, 2024
8b1d607
migrate MPT tests
mvadari Oct 30, 2024
2d129d8
migrate AccountMPTTable
mvadari Oct 30, 2024
a57fe7b
migrate Banner tests
mvadari Oct 30, 2024
d725243
migrate Header tests
mvadari Oct 30, 2024
8723b86
migrate Search tests
mvadari Oct 30, 2024
ef4e682
[WIP] Ledger page test
mvadari Oct 30, 2024
3a16d52
[WIP] migrate MPTHeader tests
mvadari Oct 30, 2024
6890e5e
migrate MPT
mvadari Nov 1, 2024
d1b9e22
migrate Details tests
mvadari Nov 1, 2024
1681294
migrate AccountMPTRow
mvadari Nov 1, 2024
a3ad364
migrates Settings tests
mvadari Nov 1, 2024
d5cc9c0
[WIP] migrate network pages
mvadari Nov 1, 2024
9452083
migrate other SimpleTab tests
mvadari Nov 1, 2024
9a88aba
migrate NFT Details
mvadari Nov 1, 2024
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