Skip to content

Commit 0259feb

Browse files
committed
data-test -> data-testid
1 parent 93a13f8 commit 0259feb

File tree

127 files changed

+594
-553
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

127 files changed

+594
-553
lines changed

src/containers/Transactions/DetailTab/HookDetails.tsx

+4-4
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ const renderHookParameterName = (name: string) => {
1818
const EmitDetails: FC<{ emitDetails: any }> = ({ emitDetails }) => {
1919
const { t } = useTranslation()
2020
return (
21-
<div className="detail-subsection" data-test="emit-details">
21+
<div className="detail-subsection" data-testid="emit-details">
2222
<div className="detail-subtitle">{t('emit_details')}</div>
2323
<li className="detail-line">
2424
<Trans
@@ -114,17 +114,17 @@ export const HookDetails: FC<{ data: { tx: any; meta: any } }> = ({ data }) => {
114114
if (!tx.EmitDetails && !tx.HookParameters && !meta.HookExecutions) return null
115115

116116
return (
117-
<div className="detail-section" data-test="hooks">
117+
<div className="detail-section" data-testid="hooks">
118118
<div className="title">{t('hooks')}</div>
119119
{tx.EmitDetails && <EmitDetails emitDetails={tx.EmitDetails} />}
120120
{tx.HookParameters && (
121-
<div className="detail-subsection" data-test="hook-params">
121+
<div className="detail-subsection" data-testid="hook-params">
122122
<div className="detail-subtitle">{t('hook_parameters')}</div>
123123
{tx.HookParameters.map(HookParameter)}
124124
</div>
125125
)}
126126
{meta.HookExecutions && (
127-
<div className="detail-subsection" data-test="hook-executions">
127+
<div className="detail-subsection" data-testid="hook-executions">
128128
<div className="detail-subtitle">{t('hook_executions')}</div>
129129
{meta.HookExecutions.map(HookExecution)}
130130
</div>

src/containers/Transactions/DetailTab/index.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ export const DetailTab: FC<{ data: any }> = ({ data }) => {
3838
}
3939

4040
return (
41-
<div className="detail-section" data-test="status">
41+
<div className="detail-section" data-testid="status">
4242
<div className="title">{t('status')}</div>
4343
{line1}
4444
{t('transaction_validated')}

src/containers/Transactions/SimpleTab.tsx

+5-5
Original file line numberDiff line numberDiff line change
@@ -44,29 +44,29 @@ export const SimpleTab: FC<{ data: any; width: number }> = ({
4444
<>
4545
<SimpleRow
4646
label={t('formatted_date', { timeZone: TIME_ZONE })}
47-
data-test="tx-date"
47+
data-testid="tx-date"
4848
>
4949
{time}
5050
</SimpleRow>
51-
<SimpleRow label={t('ledger_index')} data-test="ledger-index">
51+
<SimpleRow label={t('ledger_index')} data-testid="ledger-index">
5252
<RouteLink to={LEDGER_ROUTE} params={{ identifier: ledgerIndex }}>
5353
{ledgerIndex}
5454
</RouteLink>
5555
</SimpleRow>
5656
{account && (
57-
<SimpleRow label={t('account')} data-test="account">
57+
<SimpleRow label={t('account')} data-testid="account">
5858
<Account account={account} />
5959
</SimpleRow>
6060
)}
61-
<SimpleRow label={t('sequence_number')} data-test="sequence">
61+
<SimpleRow label={t('sequence_number')} data-testid="sequence">
6262
<Sequence
6363
sequence={sequence}
6464
ticketSequence={ticketSequence}
6565
account={account}
6666
isHook={isHook}
6767
/>
6868
</SimpleRow>
69-
<SimpleRow label={t('transaction_cost')} data-test="tx-cost">
69+
<SimpleRow label={t('transaction_cost')} data-testid="tx-cost">
7070
{fee}
7171
</SimpleRow>
7272
</>

src/containers/Transactions/test/Description.test.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,15 @@ describe('Description container', () => {
3333

3434
it('renders sequence number with ticket', () => {
3535
const wrapper = createWrapper(OfferCreateTicket)
36-
expect(wrapper.find(`[data-test="sequence"]`)).toHaveText(
36+
expect(wrapper.find(`[data-testid="sequence"]`)).toHaveText(
3737
'79469284 (a Ticket was used for this Transaction)',
3838
)
3939
wrapper.unmount()
4040
})
4141

4242
it('renders sequence number with hook', () => {
4343
const wrapper = createWrapper(EmittedPayment)
44-
expect(wrapper.find(`[data-test="sequence"]`)).toHaveText(
44+
expect(wrapper.find(`[data-testid="sequence"]`)).toHaveText(
4545
'0 (this Transaction was emitted by a Hook)',
4646
)
4747
wrapper.unmount()

src/containers/Transactions/test/DetailTab.test.tsx

+18-16
Original file line numberDiff line numberDiff line change
@@ -55,32 +55,34 @@ describe('DetailTab container', () => {
5555

5656
it('renders failed transaction', () => {
5757
const wrapper = createWrapper(FailedTransaction)
58-
expect(wrapper.find('.detail-section[data-test="status"]').text()).toEqual(
58+
expect(
59+
wrapper.find('.detail-section[data-testid="status"]').text(),
60+
).toEqual(
5961
expect.stringContaining(
6062
'This transaction failed with a status code of tecINSUFFICIENT_RESERVE, and validated in ledger 37375929 on',
6163
),
6264
)
6365
expect(
64-
wrapper.find('.detail-section[data-test="status"] .fail').text(),
66+
wrapper.find('.detail-section[data-testid="status"] .fail').text(),
6567
).toEqual('tecINSUFFICIENT_RESERVE')
6668
wrapper.unmount()
6769
})
6870

6971
it('renders hooks section', () => {
7072
const wrapper = createWrapper(HookPayment)
71-
expect(wrapper.find('.detail-section[data-test="hooks"]')).toHaveLength(1)
73+
expect(wrapper.find('.detail-section[data-testid="hooks"]')).toHaveLength(1)
7274

73-
const hooksWrapper = wrapper.find('.detail-section[data-test="hooks"]')
75+
const hooksWrapper = wrapper.find('.detail-section[data-testid="hooks"]')
7476

7577
expect(
76-
hooksWrapper.find('.detail-subsection[data-test="emit-details"]'),
78+
hooksWrapper.find('.detail-subsection[data-testid="emit-details"]'),
7779
).toHaveLength(0)
7880

7981
expect(
80-
hooksWrapper.find('.detail-subsection[data-test="hook-params"]'),
82+
hooksWrapper.find('.detail-subsection[data-testid="hook-params"]'),
8183
).toHaveLength(1)
8284
const paramWrapper = hooksWrapper.find(
83-
'.detail-subsection[data-test="hook-params"]',
85+
'.detail-subsection[data-testid="hook-params"]',
8486
)
8587
expect(paramWrapper.find('li')).toHaveLength(2)
8688
expect(paramWrapper.find('li').at(0)).toHaveText('EVR2: evnHostUpdateReg')
@@ -89,10 +91,10 @@ describe('DetailTab container', () => {
8991
)
9092

9193
expect(
92-
hooksWrapper.find('.detail-subsection[data-test="hook-executions"]'),
94+
hooksWrapper.find('.detail-subsection[data-testid="hook-executions"]'),
9395
).toHaveLength(1)
9496
const execWrapper = hooksWrapper.find(
95-
'.detail-subsection[data-test="hook-executions"]',
97+
'.detail-subsection[data-testid="hook-executions"]',
9698
)
9799
expect(execWrapper.find('li')).toHaveLength(1)
98100
expect(execWrapper.find('.detail-line')).toHaveLength(4)
@@ -115,15 +117,15 @@ describe('DetailTab container', () => {
115117

116118
it('renders hooks section for emitted tx', () => {
117119
const wrapper = createWrapper(EmittedPayment)
118-
expect(wrapper.find('.detail-section[data-test="hooks"]')).toHaveLength(1)
120+
expect(wrapper.find('.detail-section[data-testid="hooks"]')).toHaveLength(1)
119121

120-
const hooksWrapper = wrapper.find('.detail-section[data-test="hooks"]')
122+
const hooksWrapper = wrapper.find('.detail-section[data-testid="hooks"]')
121123

122124
expect(
123-
hooksWrapper.find('.detail-subsection[data-test="emit-details"]'),
125+
hooksWrapper.find('.detail-subsection[data-testid="emit-details"]'),
124126
).toHaveLength(1)
125127
const emitWrapper = hooksWrapper.find(
126-
'.detail-subsection[data-test="emit-details"]',
128+
'.detail-subsection[data-testid="emit-details"]',
127129
)
128130
expect(emitWrapper.find('.detail-line')).toHaveLength(4)
129131
expect(emitWrapper.find('.detail-line').at(0)).toHaveText(
@@ -142,14 +144,14 @@ describe('DetailTab container', () => {
142144
expect(emitWrapper.find('.detail-line').at(3).find('a')).toExist()
143145

144146
expect(
145-
hooksWrapper.find('.detail-subsection[data-test="hook-params"]'),
147+
hooksWrapper.find('.detail-subsection[data-testid="hook-params"]'),
146148
).toHaveLength(0)
147149

148150
expect(
149-
hooksWrapper.find('.detail-subsection[data-test="hook-executions"]'),
151+
hooksWrapper.find('.detail-subsection[data-testid="hook-executions"]'),
150152
).toHaveLength(1)
151153
const execWrapper = hooksWrapper.find(
152-
'.detail-subsection[data-test="hook-executions"]',
154+
'.detail-subsection[data-testid="hook-executions"]',
153155
)
154156
expect(execWrapper.find('li')).toHaveLength(1)
155157
expect(execWrapper.find('.detail-line')).toHaveLength(4)

src/containers/Validators/Simple/index.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ const Simple = ({ data }: SimpleProps) => {
1717
label: string,
1818
) =>
1919
d ? (
20-
<div className="row" data-test={`score-${className}`}>
20+
<div className="row" data-testid={`score-${className}`}>
2121
<div className="label">{label}</div>
2222
<div
2323
className={`value ${className} score`}
@@ -34,7 +34,7 @@ const Simple = ({ data }: SimpleProps) => {
3434
return (
3535
<>
3636
<SimpleRow label={t('domain')}>{data.domain || 'Unknown'}</SimpleRow>
37-
<SimpleRow label={t('rippled_version')} data-test="version">
37+
<SimpleRow label={t('rippled_version')} data-testid="version">
3838
{data.server_version}
3939
</SimpleRow>
4040
<div className="row">

src/containers/Validators/SimpleTab.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -47,15 +47,15 @@ export const SimpleTab: FC<{
4747
label={`Last Ledger ${t('formatted_date', {
4848
timeZone: TIME_ZONE,
4949
})}`}
50-
data-test="ledger-time"
50+
data-testid="ledger-time"
5151
>
5252
{localizeDate(new Date(lastLedgerTime), language, DATE_OPTIONS)}
5353
</SimpleRow>
5454
)}
5555
{ledgerIndex && (
5656
<SimpleRow
5757
label={`Last ${t('ledger_index')}`}
58-
data-test="ledger-index"
58+
data-testid="ledger-index"
5959
>
6060
<RouteLink to={LEDGER_ROUTE} params={{ identifier: ledgerIndex }}>
6161
{ledgerIndex}

src/containers/Validators/test/Validator.test.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -188,10 +188,10 @@ describe('Validator container', () => {
188188
expect(getLedger).toBeCalledWith('12345', undefined)
189189
expect(document.title).toBe('Validator test.example.com')
190190
// test ledger-time isn't updated
191-
const lastLedgerDateTime = wrapper.find(`[data-test="ledger-time"]`)
191+
const lastLedgerDateTime = wrapper.find(`[data-testid="ledger-time"]`)
192192
expect(lastLedgerDateTime).not.toExist()
193193
// test ledger-index stays the same
194-
const lastLedgerIndex = wrapper.find(`[data-test="ledger-index"]`)
194+
const lastLedgerIndex = wrapper.find(`[data-testid="ledger-index"]`)
195195
expect(lastLedgerIndex).toExist()
196196
expect(lastLedgerIndex.find('.value')).toHaveText('12345')
197197
wrapper.unmount()

src/containers/shared/components/Sequence.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ export const Sequence: FC<SequenceProps> = ({
3030
return (
3131
<span>
3232
{sequence === 0 && !isPseudoTransaction ? (
33-
<span className="row" data-test="sequence">
33+
<span className="row" data-testid="sequence">
3434
{ticketSequence}
3535
{' ('}
3636
{getContext()})

src/containers/shared/components/Transaction/AMMBid/Simple.tsx

+4-4
Original file line numberDiff line numberDiff line change
@@ -11,22 +11,22 @@ export const Simple = ({ data }: TransactionSimpleProps) => {
1111
return (
1212
<>
1313
{ammAccountID && (
14-
<SimpleRow label={t('amm_account_id')} data-test="account_id">
14+
<SimpleRow label={t('amm_account_id')} data-testid="account_id">
1515
<Account account={ammAccountID} />
1616
</SimpleRow>
1717
)}
1818
{bidMin && (
19-
<SimpleRow label={t('min_slot_price')} data-test="min_slot_price">
19+
<SimpleRow label={t('min_slot_price')} data-testid="min_slot_price">
2020
<Amount value={bidMin} />
2121
</SimpleRow>
2222
)}
2323
{bidMax && (
24-
<SimpleRow label={t('max_slot_price')} data-test="max_slot_price">
24+
<SimpleRow label={t('max_slot_price')} data-testid="max_slot_price">
2525
<Amount value={bidMax} />
2626
</SimpleRow>
2727
)}
2828
{authAccounts && (
29-
<SimpleRow label={t('auth_accounts')} data-test="auth_accounts">
29+
<SimpleRow label={t('auth_accounts')} data-testid="auth_accounts">
3030
{authAccounts.map((accID: string) => (
3131
<Account account={accID} />
3232
))}

src/containers/shared/components/Transaction/AMMClawback/Simple.tsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,16 @@ export const Simple = ({ data }: TransactionSimpleProps) => {
99
const { amount2, amount, holder } = data.instructions
1010
return (
1111
<>
12-
<SimpleRow label={t('holder')} data-test="holder">
12+
<SimpleRow label={t('holder')} data-testid="holder">
1313
<Account account={holder} />
1414
</SimpleRow>
1515
{amount && (
16-
<SimpleRow label={t('asset1')} data-test="asset1">
16+
<SimpleRow label={t('asset1')} data-testid="asset1">
1717
<Amount value={amount} displayIssuer />
1818
</SimpleRow>
1919
)}
2020
{amount2 && (
21-
<SimpleRow label={t('asset2')} data-test="asset2">
21+
<SimpleRow label={t('asset2')} data-testid="asset2">
2222
<Amount value={amount2} displayIssuer />
2323
</SimpleRow>
2424
)}

src/containers/shared/components/Transaction/AMMCreate/Simple.tsx

+4-4
Original file line numberDiff line numberDiff line change
@@ -13,22 +13,22 @@ export const Simple = ({ data }: TransactionSimpleProps) => {
1313
return (
1414
<>
1515
{ammAccountID && (
16-
<SimpleRow label={t('amm_account_id')} data-test="account_id">
16+
<SimpleRow label={t('amm_account_id')} data-testid="account_id">
1717
<Account account={ammAccountID} />
1818
</SimpleRow>
1919
)}
2020
{amount && (
21-
<SimpleRow label={t('asset1')} data-test="asset1">
21+
<SimpleRow label={t('asset1')} data-testid="asset1">
2222
<Amount value={amount} />
2323
</SimpleRow>
2424
)}
2525
{amount2 && (
26-
<SimpleRow label={t('asset2')} data-test="asset2">
26+
<SimpleRow label={t('asset2')} data-testid="asset2">
2727
<Amount value={amount2} />
2828
</SimpleRow>
2929
)}
3030
{tf && (
31-
<SimpleRow label={t('trading_fee')} data-test="trading_fee">
31+
<SimpleRow label={t('trading_fee')} data-testid="trading_fee">
3232
{tf}%
3333
</SimpleRow>
3434
)}

src/containers/shared/components/Transaction/AMMDelete/Description.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export const Description = ({
99
const { Asset, Asset2 } = data.tx
1010

1111
return (
12-
<div data-test="amm-delete-description">
12+
<div data-testid="amm-delete-description">
1313
<Trans
1414
i18nKey="amm_delete_description"
1515
components={{

src/containers/shared/components/Transaction/AMMDelete/Simple.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ export const Simple = ({ data }: TransactionSimpleProps<AMMDelete>) => {
1111

1212
return (
1313
<>
14-
<SimpleRow label={t('asset1')} data-test="asset1">
14+
<SimpleRow label={t('asset1')} data-testid="asset1">
1515
<Currency currency={Asset.currency} issuer={Asset.issuer} />
1616
</SimpleRow>
17-
<SimpleRow label={t('asset2')} data-test="asset2">
17+
<SimpleRow label={t('asset2')} data-testid="asset2">
1818
<Currency currency={Asset2.currency} issuer={Asset2.issuer} />
1919
</SimpleRow>
2020
</>

src/containers/shared/components/Transaction/AMMDelete/TableDetail.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@ export const TableDetail = ({
1111

1212
return (
1313
<div className="ammDelete">
14-
<div data-test="asset">
14+
<div data-testid="asset">
1515
<span className="label">{t('asset1')}</span>
1616
<Currency currency={Asset.currency} issuer={(Asset as any).issuer} />
1717
</div>
18-
<div data-test="asset2">
18+
<div data-testid="asset2">
1919
<span className="label">{t('asset2')}</span>
2020
<Currency currency={Asset2.currency} issuer={(Asset2 as any).issuer} />
2121
</div>

src/containers/shared/components/Transaction/AMMDelete/test/AMMDeleteDescription.test.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ describe('AMMDelete: Description', () => {
99
it('renders description for AMMDelete transaction', () => {
1010
const wrapper = createWrapper(mockAMMDelete)
1111

12-
expect(wrapper.find('[data-test="amm-delete-description"]')).toHaveText(
12+
expect(wrapper.find('[data-testid="amm-delete-description"]')).toHaveText(
1313
'Attempted to delete the AMM for \uE900 XRP and FOO.rm5c42Crqpdch5fbuCdHmSMV1wrL9arV9.If there were more than 512 trustlines, this only removes 512 trustlines instead.',
1414
)
1515
expect(wrapper.find('a')).toHaveProp(

src/containers/shared/components/Transaction/AMMDelete/test/AMMDeleteTableDetail.test.tsx

+4-2
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,10 @@ describe('AMMDelete: TableDetail', () => {
99
it('renders with an expiration and offer', () => {
1010
const wrapper = createWrapper(mockAMMDelete)
1111

12-
expect(wrapper.find('[data-test="asset"]')).toHaveText('Asset 1\uE900 XRP')
13-
expect(wrapper.find('[data-test="asset2"]')).toHaveText(
12+
expect(wrapper.find('[data-testid="asset"]')).toHaveText(
13+
'Asset 1\uE900 XRP',
14+
)
15+
expect(wrapper.find('[data-testid="asset2"]')).toHaveText(
1416
'Asset 2FOO.rm5c42Crqpdch5fbuCdHmSMV1wrL9arV9',
1517
)
1618
wrapper.unmount()

0 commit comments

Comments
 (0)