import React from 'react'; import { render, screen } from '@testing-library/react-native'; import Toast from '../Toast'; jest.mock('../../../icons', () => ({ IconMASuccess1: () => null, IconMAFail1: () => null, IconMAWarning1: () => null, })); jest.mock('@xrnjs/ui', () => ({ Popup: ({ children }: { children: React.ReactNode }) => <>{children}, Loading: () => null, useTheme: () => ({}), ShouldRender: ({ condition, children, }: { condition: boolean; children: React.ReactNode; }) => (condition ? <>{children} : null), })); jest.mock('../styles/toast.style', () => () => ({ toast: {}, inner: {}, inner_type_text: {}, inner_overlay: {}, icon: {}, text: {}, text_top_0: {}, text_overlay: {}, })); describe('Toast numberOfLines', () => { test('keeps the two-line default', () => { const message = 'Default toast message'; render(); expect(screen.getByText(message).props.numberOfLines).toBe(2); }); test('passes the external numberOfLines to the message', () => { const message = 'The recipient account could not be verified. Please confirm all recipient details before trying this transfer again.'; render(); expect(screen.getByText(message).props.numberOfLines).toBe(0); }); });