Skip to content

Commit f5429aa

Browse files
test: add component view tests
Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent b313002 commit f5429aa

13 files changed

Lines changed: 713 additions & 314 deletions

File tree

app/components/UI/DeFiPositions/DeFiProtocolPositionDetails.view.test.tsx

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ const defiDetailsState = {
9696
};
9797

9898
describeForPlatforms('DeFi position details (read-only)', () => {
99-
it('shows protocol header, Supplied rows, and token symbols (Aave V3)', () => {
99+
it('shows Aave V3 supplied assets with token symbols and fiat amounts', () => {
100100
const { getByTestId, getByText, getAllByText, UNSAFE_getByType } =
101101
renderComponentViewScreen(
102102
DeFiProtocolPositionDetails,
@@ -117,10 +117,10 @@ describeForPlatforms('DeFi position details (read-only)', () => {
117117
getByTestId(DEFI_PROTOCOL_POSITION_DETAILS_BALANCE_TEST_ID),
118118
).toHaveTextContent('$14.74');
119119

120-
// One "Supplied" label per supplied position group (same copy as smoke E2E).
121-
expect(getAllByText('Supplied').length).toBeGreaterThanOrEqual(1);
122-
expect(getAllByText('USDT').length).toBeGreaterThanOrEqual(1);
123-
expect(getAllByText('WETH').length).toBeGreaterThanOrEqual(1);
120+
// Smoke parity for details checks: Supplied + USDT + WETH + $14.74 + $0.30.
121+
expect(getAllByText('Supplied')).toHaveLength(2);
122+
expect(getAllByText('USDT')).toHaveLength(1);
123+
expect(getAllByText('$14.74').length).toBeGreaterThanOrEqual(2);
124124

125125
const list = UNSAFE_getByType(FlatList);
126126
act(() => {
@@ -133,6 +133,7 @@ describeForPlatforms('DeFi position details (read-only)', () => {
133133
});
134134
});
135135

136-
expect(getByText('USDT')).toBeOnTheScreen();
136+
expect(getByText('WETH')).toBeOnTheScreen();
137+
expect(getByText('$0.30')).toBeOnTheScreen();
137138
});
138139
});

app/components/UI/MarketInsights/Views/MarketInsightsView/MarketInsightsView.view.test.tsx

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
/**
2-
* Component view tests for token (non-Perps) MarketInsightsView: content, swap/buy navigation, thumbs up.
3-
* Mirrors smoke: tests/smoke/assets/market-insights/view-market-insights.spec.ts (cases 7, 10, 11).
2+
* Component view tests for token (non-Perps) MarketInsightsView: content,
3+
* swap/buy navigation, trend sources sheet, thumbs up.
4+
* Mirrors smoke: tests/smoke/assets/market-insights/view-market-insights.spec.ts
5+
* (cases 7, 10, 11, 12). Entry card visibility cases (8, 9) are covered by
6+
* AssetOverviewContent.view.test.tsx.
47
* Run: yarn test:view:one MarketInsightsView.view.test.tsx
58
*/
69
import '../../../../../../tests/component-view/mocks';
@@ -79,6 +82,22 @@ describeForPlatforms('MarketInsightsView (token flow)', () => {
7982
).toBeOnTheScreen();
8083
});
8184

85+
it('shows sources bottom sheet when tapping a trend item', async () => {
86+
renderMarketInsightsViewWithNavigation({
87+
initialParams: ETH_MAINNET_ROUTE_PARAMS,
88+
});
89+
90+
await screen.findByTestId(MarketInsightsSelectorsIDs.VIEW_CONTAINER);
91+
92+
fireEvent.press(
93+
await screen.findByTestId(`${MarketInsightsSelectorsIDs.TREND_ITEM}-0`),
94+
);
95+
96+
expect(
97+
await screen.findByText('Spot Ethereum ETFs See Record Weekly Inflows'),
98+
).toBeOnTheScreen();
99+
});
100+
82101
it('can tap thumbs up feedback button', async () => {
83102
const trackEventSpy = jest.spyOn(analytics, 'trackEvent');
84103
try {

app/components/Views/confirmations/ConfirmationView.testIds.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,10 @@ export const ConfirmationFooterSelectorIDs = {
5555
CONFIRM_BUTTON: 'confirm-button',
5656
} as const;
5757

58+
export const ConfirmationLoaderSelectorIDs = {
59+
TRANSFER: 'confirm-loader-transfer',
60+
} as const;
61+
5862
export const ConfirmAlertModalSelectorsIDs = {
5963
CONFIRM_ALERT_CHECKBOX: 'confirm-alert-checkbox',
6064
CONFIRM_ALERT_BUTTON: 'confirm-alert-confirm-button',

0 commit comments

Comments
 (0)