Skip to content

Commit d03fdcf

Browse files
committed
fix: preserve links in ExportIntegration reasoning path; add EXPORTED_TO_INTEGRATION hasReasoning tests
Switch ExportIntegration.tsx from getExportIntegrationLastMessageText (plain text, strips URLs) to getExportIntegrationMessageHTML (returns <a href> fragments) so the reasoning branch renders clickable links via RenderHTML. Add two PureReportActionItemTest cases covering the hasReasoning branch: one asserting the Explain link appears when reasoning is present, one asserting it is absent otherwise.
1 parent 281da4f commit d03fdcf

2 files changed

Lines changed: 25 additions & 2 deletions

File tree

src/components/ReportActionItem/ExportIntegration.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import Text from '@components/Text';
66
import TextLink from '@components/TextLink';
77
import useLocalize from '@hooks/useLocalize';
88
import useThemeStyles from '@hooks/useThemeStyles';
9-
import {getExportIntegrationActionFragments, getExportIntegrationLastMessageText, hasReasoning} from '@libs/ReportActionsUtils';
9+
import {getExportIntegrationActionFragments, getExportIntegrationMessageHTML, hasReasoning} from '@libs/ReportActionsUtils';
1010
import ReportActionItemMessageWithExplain from '@pages/inbox/report/ReportActionItemMessageWithExplain';
1111
import type {Report, ReportAction} from '@src/types/onyx';
1212

@@ -25,7 +25,7 @@ function ExportIntegration({action, childReport, originalReport}: ExportIntegrat
2525
const {translate} = useLocalize();
2626

2727
if (hasReasoning(action)) {
28-
const message = getExportIntegrationLastMessageText(translate, action);
28+
const message = getExportIntegrationMessageHTML(translate, action);
2929
return (
3030
<ReportActionItemMessageWithExplain
3131
message={message}

tests/ui/PureReportActionItemTest.tsx

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1573,6 +1573,29 @@ describe('PureReportActionItem', () => {
15731573

15741574
expect(screen.getByText(/exported to/i)).toBeOnTheScreen();
15751575
});
1576+
1577+
it('EXPORTED_TO_INTEGRATION with reasoning shows Explain link', async () => {
1578+
const action = createReportAction(CONST.REPORT.ACTIONS.TYPE.EXPORTED_TO_INTEGRATION, {
1579+
label: 'NetSuite',
1580+
automaticAction: true,
1581+
reasoning: 'Test reasoning',
1582+
});
1583+
renderItemWithAction(action);
1584+
await waitForBatchedUpdatesWithAct();
1585+
1586+
expect(screen.getByText('Explain')).toBeOnTheScreen();
1587+
});
1588+
1589+
it('EXPORTED_TO_INTEGRATION without reasoning does not show Explain link', async () => {
1590+
const action = createReportAction(CONST.REPORT.ACTIONS.TYPE.EXPORTED_TO_INTEGRATION, {
1591+
label: 'NetSuite',
1592+
automaticAction: true,
1593+
});
1594+
renderItemWithAction(action);
1595+
await waitForBatchedUpdatesWithAct();
1596+
1597+
expect(screen.queryByText('Explain')).not.toBeOnTheScreen();
1598+
});
15761599
});
15771600

15781601
describe('Card freeze/unfreeze actions', () => {

0 commit comments

Comments
 (0)