Skip to content

Commit eef521f

Browse files
committed
tests
1 parent e7cd5e6 commit eef521f

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/__tests__/render.test.tsx

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,3 +70,15 @@ test('unmount function unmounts component asynchronously', async () => {
7070
await screen.unmount();
7171
expect(fn).toHaveBeenCalled();
7272
});
73+
74+
test('render accepts RCTText component', async () => {
75+
await render(React.createElement('RCTText', { testID: 'text' }, 'Hello'));
76+
expect(screen.getByTestId('text')).toBeOnTheScreen();
77+
expect(screen.getByText('Hello')).toBeOnTheScreen();
78+
});
79+
80+
test('render throws when text string is rendered without Text component', async () => {
81+
await expect(render(<View>Hello</View>)).rejects.toThrowErrorMatchingInlineSnapshot(
82+
`"Invariant Violation: Text strings must be rendered within a <Text> component. Detected attempt to render "Hello" string within a <View> component."`,
83+
);
84+
});

0 commit comments

Comments
 (0)