I'm using react-native and I want to test that when I insert some text to the component like: "barak walk".
when it's too long it converts it to "barak walk...".
I built the component and it worked as I excepted, but the test didn't
export const Card =({ text }: Props): JSX.Element => {
return (
<View style={{width:160}}>
<Text numberOfLines={1} style={cardText}>
{text}
</Text>
</View>
);
};
test('Long text should convert to 3 dots', () => {
const longText = 'barak walk aaaaaaaaaaaaa';
const expectText = 'barak walk...'
const wrapper = mount(<Card text={longText} />)
const textView = wrapper.find(Text);
expect(textView.text()).toBe(expectText);
});
I get this error:
Expected: "barak walk..."
Received: "barak walk aaaaaaaaaaaaa"