From 2976fbed6f576c0aa4f38f65fbd596b371935b13 Mon Sep 17 00:00:00 2001 From: Mayukha Vadari <mvadari@gmail.com> Date: Fri, 5 Jul 2024 16:36:16 -0400 Subject: [PATCH] fix tests --- .../Transaction/EscrowCreate/TableDetail.tsx | 2 +- .../Transaction/OracleDelete/Simple.tsx | 2 +- .../components/Transaction/OracleSet/Simple.tsx | 17 ++++++++++------- .../PaymentChannelClaim/TableDetail.tsx | 2 +- .../PaymentChannelClaimTableDetail.test.tsx | 8 ++++---- .../PaymentChannelCreate/TableDetail.tsx | 2 +- .../PaymentChannelCreateTableDetail.test.tsx | 10 +++------- .../Transaction/PaymentChannelFund/Simple.tsx | 2 +- .../test/PaymentChannelFundSimple.test.tsx | 6 +++--- 9 files changed, 25 insertions(+), 26 deletions(-) diff --git a/src/containers/shared/components/Transaction/EscrowCreate/TableDetail.tsx b/src/containers/shared/components/Transaction/EscrowCreate/TableDetail.tsx index e25169d85..8300b5caa 100644 --- a/src/containers/shared/components/Transaction/EscrowCreate/TableDetail.tsx +++ b/src/containers/shared/components/Transaction/EscrowCreate/TableDetail.tsx @@ -15,7 +15,7 @@ export const TableDetail = (props: any) => { {amount && ( <div> <span className="label">{t('amount')}</span> - <Amount value={amount} data-testid="amount" /> + <Amount value={amount} /> </div> )} {destination && ( diff --git a/src/containers/shared/components/Transaction/OracleDelete/Simple.tsx b/src/containers/shared/components/Transaction/OracleDelete/Simple.tsx index 98bf591a9..a230dcaea 100644 --- a/src/containers/shared/components/Transaction/OracleDelete/Simple.tsx +++ b/src/containers/shared/components/Transaction/OracleDelete/Simple.tsx @@ -8,7 +8,7 @@ export const Simple: TransactionSimpleComponent = ({ const { t } = useTranslation() const { OracleDocumentID } = data.instructions return ( - <SimpleRow label={t('oracle_document_id')} data-test="oracle-document-id"> + <SimpleRow label={t('oracle_document_id')} data-testid="oracle-document-id"> {OracleDocumentID} </SimpleRow> ) diff --git a/src/containers/shared/components/Transaction/OracleSet/Simple.tsx b/src/containers/shared/components/Transaction/OracleSet/Simple.tsx index 08bb96471..e282fc07b 100644 --- a/src/containers/shared/components/Transaction/OracleSet/Simple.tsx +++ b/src/containers/shared/components/Transaction/OracleSet/Simple.tsx @@ -22,23 +22,26 @@ export const Simple: TransactionSimpleComponent = ({ } = data.instructions return ( <> - <SimpleRow label={t('oracle_document_id')} data-test="oracle-document-id"> + <SimpleRow + label={t('oracle_document_id')} + data-testid="oracle-document-id" + > {oracleDocumentID} </SimpleRow> {provider && ( - <SimpleRow label={t('provider')} data-test="provider"> + <SimpleRow label={t('provider')} data-testid="provider"> {provider} </SimpleRow> )} {uri && ( - <SimpleRow label={t('uri')} data-test="uri"> + <SimpleRow label={t('uri')} data-testid="uri"> {uri} </SimpleRow> )} - <SimpleRow label={t('last_update_time')} data-test="last-update-time"> + <SimpleRow label={t('last_update_time')} data-testid="last-update-time"> {localizeDate( new Date(lastUpdateTime * MILLIS_PER_SECOND), language, @@ -47,14 +50,14 @@ export const Simple: TransactionSimpleComponent = ({ </SimpleRow> {assetClass && ( - <SimpleRow label={t('asset_class')} data-test="asset-class"> + <SimpleRow label={t('asset_class')} data-testid="asset-class"> {assetClass} </SimpleRow> )} - <SimpleRow label={t('trading_pairs')} data-test="trading-pairs"> + <SimpleRow label={t('trading_pairs')} data-testid="trading-pairs"> {priceDataSeries.map((priceDataObj) => ( - <div className="amount list" data-test="amount"> + <div className="amount list" data-testid="amount"> {priceDataObj.assetPrice ?? t('deleted')} <div className="one-line"> <Currency currency={priceDataObj.baseAsset} />/ diff --git a/src/containers/shared/components/Transaction/PaymentChannelClaim/TableDetail.tsx b/src/containers/shared/components/Transaction/PaymentChannelClaim/TableDetail.tsx index 18023b916..1a249f37e 100644 --- a/src/containers/shared/components/Transaction/PaymentChannelClaim/TableDetail.tsx +++ b/src/containers/shared/components/Transaction/PaymentChannelClaim/TableDetail.tsx @@ -51,7 +51,7 @@ export const TableDetail = ({ </div> )} {channelAmount && !claimed && ( - <div data-testid="amount"> + <div data-testid="channel-amount"> <span className="label">{t('channel_amount')}</span> <Amount value={channelAmount} /> </div> diff --git a/src/containers/shared/components/Transaction/PaymentChannelClaim/test/PaymentChannelClaimTableDetail.test.tsx b/src/containers/shared/components/Transaction/PaymentChannelClaim/test/PaymentChannelClaimTableDetail.test.tsx index 67754651d..de68e843d 100644 --- a/src/containers/shared/components/Transaction/PaymentChannelClaim/test/PaymentChannelClaimTableDetail.test.tsx +++ b/src/containers/shared/components/Transaction/PaymentChannelClaim/test/PaymentChannelClaimTableDetail.test.tsx @@ -21,7 +21,7 @@ describe('PaymentChannelClaim: TableDetail', () => { expect(wrapper.find('[data-testid="claimed"]')).toHaveText( 'claimed\uE9000.01 XRP (\uE90020.34284 XRP of \uE90070.00 XRP remaining)', ) - expect(wrapper.find('[data-testid="amount"]')).not.toExist() + expect(wrapper.find('[data-testid="channel-amount"]')).not.toExist() expect(wrapper.find('[data-testid="renew"]')).not.toExist() expect(wrapper.find('[data-testid="close-request"]')).not.toExist() expect(wrapper.find('[data-testid="closed"]')).not.toExist() @@ -37,7 +37,7 @@ describe('PaymentChannelClaim: TableDetail', () => { 'destinationrK6g2UYc4GpQH8DYdPG7wywyQbxkJpQTTN', ) expect(wrapper.find('[data-testid="claimed"]')).not.toExist() - expect(wrapper.find('[data-testid="amount"]')).toHaveText( + expect(wrapper.find('[data-testid="channel-amount"]')).toHaveText( 'channel amount\uE90010.00 XRP', ) expect(wrapper.find('[data-testid="renew"]')).not.toExist() @@ -59,7 +59,7 @@ describe('PaymentChannelClaim: TableDetail', () => { 'destinationrK6g2UYc4GpQH8DYdPG7wywyQbxkJpQTTN', ) expect(wrapper.find('[data-testid="claimed"]')).not.toExist() - expect(wrapper.find('[data-testid="amount"]')).toHaveText( + expect(wrapper.find('[data-testid="channel-amount"]')).toHaveText( 'channel amount\uE90010.00 XRP', ) expect(wrapper.find('[data-testid="renew"]')).not.toExist() @@ -81,7 +81,7 @@ describe('PaymentChannelClaim: TableDetail', () => { expect(wrapper.find('[data-testid="claimed"]')).toHaveText( 'claimed\uE9001.00 XRP (\uE90099.00 XRP of \uE900100.00 XRP remaining)', ) - expect(wrapper.find('[data-testid="amount"]')).not.toExist() + expect(wrapper.find('[data-testid="channel-amount"]')).not.toExist() expect(wrapper.find('[data-testid="renew"]')).not.toExist() expect(wrapper.find('[data-testid="close-request"]')).not.toExist() expect(wrapper.find('[data-testid="closed"]')).not.toExist() diff --git a/src/containers/shared/components/Transaction/PaymentChannelCreate/TableDetail.tsx b/src/containers/shared/components/Transaction/PaymentChannelCreate/TableDetail.tsx index f40968708..bca200507 100644 --- a/src/containers/shared/components/Transaction/PaymentChannelCreate/TableDetail.tsx +++ b/src/containers/shared/components/Transaction/PaymentChannelCreate/TableDetail.tsx @@ -20,7 +20,7 @@ export const TableDetail = ({ <span className="label">{t('destination')}</span> <Account account={destination} /> </div> - <div data-testid="amount"> + <div> <span className="label">{t('channel_amount')}</span> <Amount value={amount} /> </div> diff --git a/src/containers/shared/components/Transaction/PaymentChannelCreate/test/PaymentChannelCreateTableDetail.test.tsx b/src/containers/shared/components/Transaction/PaymentChannelCreate/test/PaymentChannelCreateTableDetail.test.tsx index b31e4c8fe..bef431ba4 100644 --- a/src/containers/shared/components/Transaction/PaymentChannelCreate/test/PaymentChannelCreateTableDetail.test.tsx +++ b/src/containers/shared/components/Transaction/PaymentChannelCreate/test/PaymentChannelCreateTableDetail.test.tsx @@ -17,9 +17,7 @@ describe('PaymentChannelCreate: TableDetail', () => { expect(wrapper.find('[data-testid="destination"]')).toHaveText( 'destinationrUXYat4hW2M87gHoqKK7fC4cqrT9C6V7d7', ) - expect(wrapper.find('[data-testid="amount"]')).toHaveText( - 'channel amount\uE9001.00 XRP', - ) + expect(wrapper.find('[data-testid="amount"]')).toHaveText('\uE9001.00 XRP') wrapper.unmount() }) @@ -31,9 +29,7 @@ describe('PaymentChannelCreate: TableDetail', () => { expect(wrapper.find('[data-testid="destination"]')).toHaveText( 'destinationrK6g2UYc4GpQH8DYdPG7wywyQbxkJpQTTN', ) - expect(wrapper.find('[data-testid="amount"]')).toHaveText( - 'channel amount\uE90010.00 XRP', - ) + expect(wrapper.find('[data-testid="amount"]')).toHaveText('\uE90010.00 XRP') wrapper.unmount() }) @@ -46,7 +42,7 @@ describe('PaymentChannelCreate: TableDetail', () => { 'destinationrf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn:20170428', ) expect(wrapper.find('[data-testid="amount"]')).toHaveText( - 'channel amount\uE900100.00 XRP', + '\uE900100.00 XRP', ) wrapper.unmount() }) diff --git a/src/containers/shared/components/Transaction/PaymentChannelFund/Simple.tsx b/src/containers/shared/components/Transaction/PaymentChannelFund/Simple.tsx index 3cc50f12b..a1111c43c 100644 --- a/src/containers/shared/components/Transaction/PaymentChannelFund/Simple.tsx +++ b/src/containers/shared/components/Transaction/PaymentChannelFund/Simple.tsx @@ -26,7 +26,7 @@ export const Simple = ({ </SimpleRow> )} {channelAmount && ( - <SimpleRow label={t('channel_amount')} data-testid="amount"> + <SimpleRow label={t('channel_amount')} data-testid="channel-amount"> <Amount value={channelAmount} /> </SimpleRow> )} diff --git a/src/containers/shared/components/Transaction/PaymentChannelFund/test/PaymentChannelFundSimple.test.tsx b/src/containers/shared/components/Transaction/PaymentChannelFund/test/PaymentChannelFundSimple.test.tsx index 743ca5a69..a9b884ad6 100644 --- a/src/containers/shared/components/Transaction/PaymentChannelFund/test/PaymentChannelFundSimple.test.tsx +++ b/src/containers/shared/components/Transaction/PaymentChannelFund/test/PaymentChannelFundSimple.test.tsx @@ -17,8 +17,8 @@ describe('PaymentChannelFund: Simple', () => { const wrapper = createWrapper(mockPaymentChannelFund) expectSimpleRowLabel(wrapper, 'increase', 'channel amount increase') expectSimpleRowText(wrapper, 'increase', '+\uE9001.00 XRP') - expectSimpleRowLabel(wrapper, 'amount', 'channel amount') - expectSimpleRowText(wrapper, 'amount', '\uE90075.00 XRP') + expectSimpleRowLabel(wrapper, 'channel-amount', 'channel amount') + expectSimpleRowText(wrapper, 'channel-amount', '\uE90075.00 XRP') expectSimpleRowLabel(wrapper, 'total', 'total claimed') expectSimpleRowText(wrapper, 'total', '\uE90061.859345 XRP') expectSimpleRowLabel(wrapper, 'source', 'source') @@ -46,7 +46,7 @@ describe('PaymentChannelFund: Simple', () => { const wrapper = createWrapper(mockPaymentChannelFundFailed) expectSimpleRowLabel(wrapper, 'increase', 'channel amount increase') expectSimpleRowText(wrapper, 'increase', '+\uE90020.00 XRP') - expectSimpleRowNotToExist(wrapper, 'amount') + expectSimpleRowNotToExist(wrapper, 'channel-amount') expectSimpleRowNotToExist(wrapper, 'total') expectSimpleRowNotToExist(wrapper, 'source') expectSimpleRowNotToExist(wrapper, 'destination')