Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 4 additions & 8 deletions app/components/UI/DefiEmptyState/DefiEmptyState.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,15 @@ describe('DefiEmptyState', () => {
expect(getByText('Explore DeFi')).toBeDefined();
});

it('should navigate to explore tokens page in in-app browser', () => {
it('opens Explore on the main feed then Sites full view', () => {
const { getByText } = renderWithProvider(<DefiEmptyState />);

const button = getByText('Explore DeFi');
fireEvent.press(button);

expect(mockNavigate).toHaveBeenCalledWith('BrowserTabHome', {
screen: 'BrowserView',
params: {
newTabUrl:
'https://portfolio.metamask.io/explore/tokens?MetaMaskEntry=mobile',
timestamp: expect.any(Number),
},
expect(mockNavigate).toHaveBeenNthCalledWith(1, 'TrendingView', {
screen: 'TrendingFeed',
});
expect(mockNavigate).toHaveBeenNthCalledWith(2, 'SitesFullView');
});
});
12 changes: 4 additions & 8 deletions app/components/UI/DefiEmptyState/DefiEmptyState.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import {
type TabEmptyStateProps,
} from '../../../component-library/components-temp/TabEmptyState';
import { strings } from '../../../../locales/i18n';
import AppConstants from '../../../core/AppConstants';
import Routes from '../../../constants/navigation/Routes';

import emptyStateDefiLight from '../../../images/empty-state-defi-light.png';
Expand All @@ -22,14 +21,11 @@ export const DefiEmptyState: React.FC<DefiEmptyStateProps> = (props) => {
const tw = useTailwind();

const handleExploreDefi = () => {
// Navigate to explore tokens page in the in-app browser
navigate(Routes.BROWSER.HOME, {
screen: Routes.BROWSER.VIEW,
params: {
newTabUrl: AppConstants.EXPLORE_TOKENS.URL,
timestamp: Date.now(),
},
// Open the Explore tab on the main feed, then push Sites (root stack).
navigate(Routes.TRENDING_VIEW, {
screen: Routes.TRENDING_FEED,
});
navigate(Routes.SITES_FULL_VIEW);
};

return (
Expand Down
Loading