Skip to content

Commit 1c99145

Browse files
committed
test(matchers/to-have-text-content): add negative (.not) variant test
1 parent 6f65d53 commit 1c99145

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/matchers/__tests__/to-have-text-content.test.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,16 @@ it('verifies element has expected text content', async () => {
77
const Component = () => (
88
<View>
99
<Text testID="text-element">Hello World</Text>
10+
<Text testID="other-element">Other Text</Text>
1011
</View>
1112
);
1213

1314
await render(<Component />);
1415

1516
const element = screen.getByTestId('text-element');
17+
const otherElement = screen.getByTestId('other-element');
18+
1619
expect(element).toHaveTextContent('Hello World');
20+
expect(element).not.toHaveTextContent('Other Text');
21+
expect(otherElement).not.toHaveTextContent('Hello World');
1722
});

0 commit comments

Comments
 (0)