Skip to content

Commit 21cdc2c

Browse files
authored
docs(jest-native): Explicitly show what's rendered (#959)
1 parent a18d41b commit 21cdc2c

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

docs/ecosystem-jest-native.mdx

+9-7
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,16 @@ npm install --save-dev @testing-library/jest-native
1313
```
1414

1515
```javascript
16-
;<View>
17-
<View testID="not-empty">
18-
<Text testID="empty" />
19-
</View>
20-
<Text testID="visible">Visible Example</Text>
21-
</View>
16+
const {queryByTestId} = render(
17+
<View>
18+
<View testID="not-empty">
19+
<Text testID="empty" />
20+
</View>
21+
<Text testID="visible">Visible Example</Text>
22+
</View>,
23+
)
2224

23-
expect(queryByTestId(baseElement, 'not-empty')).not.toBeEmpty()
25+
expect(queryByTestId('not-empty')).not.toBeEmpty()
2426
```
2527

2628
> Note: when using some of these matchers, you may need to make sure you use a

0 commit comments

Comments
 (0)