Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mvadari committed Jul 5, 2024
1 parent 9092b7c commit 71c5bbd
Show file tree
Hide file tree
Showing 9 changed files with 25 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 && (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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>
)
Expand Down
17 changes: 10 additions & 7 deletions src/containers/shared/components/Transaction/OracleSet/Simple.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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} />/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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()
Expand All @@ -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()
Expand All @@ -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()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()
})

Expand All @@ -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()
})

Expand All @@ -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()
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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>
)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down Expand Up @@ -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')
Expand Down

0 comments on commit 71c5bbd

Please sign in to comment.