test(matchers/to-have-text-content): add negative (.not) variant test

This commit is contained in:
Maciej Jastrzębski
2026-01-09 00:07:43 +01:00
parent 6f65d530e3
commit 1c99145bc7
@@ -7,11 +7,16 @@ it('verifies element has expected text content', async () => {
const Component = () => (
<View>
<Text testID="text-element">Hello World</Text>
<Text testID="other-element">Other Text</Text>
</View>
);
await render(<Component />);
const element = screen.getByTestId('text-element');
const otherElement = screen.getByTestId('other-element');
expect(element).toHaveTextContent('Hello World');
expect(element).not.toHaveTextContent('Other Text');
expect(otherElement).not.toHaveTextContent('Hello World');
});