We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 4597866 commit e1d5730Copy full SHA for e1d5730
src/__tests__/wait-for.test.tsx
@@ -0,0 +1,20 @@
1
+import * as React from 'react';
2
+import { Text, View } from 'react-native';
3
+
4
+import { render, screen, waitFor } from '..';
5
6
+test('waits for query', async () => {
7
+ function AsyncComponent() {
8
+ const [text, setText] = React.useState('Loading...');
9
10
+ React.useEffect(() => {
11
+ setTimeout(() => setText('Loaded'), 100);
12
+ }, []);
13
14
+ return <Text>{text}</Text>;
15
+ }
16
17
+ await render(<AsyncComponent />);
18
+ await waitFor(() => screen.getByText('Loaded'));
19
+ expect(screen.getByText('Loaded')).toBeOnTheScreen();
20
+});
0 commit comments