Skip to content

Commit ea795ba

Browse files
committed
refactor: centralize renderer selection
1 parent e5eb0c3 commit ea795ba

21 files changed

+22
-97
lines changed

src/__tests__/auto-cleanup.test.tsx

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
import * as React from 'react';
22
import { View } from 'react-native';
3-
import { configure, render } from '..';
4-
5-
beforeEach(() => {
6-
configure({ renderer: 'internal' });
7-
});
3+
import { render } from '..';
84

95
let isMounted = false;
106

src/__tests__/host-component-names.test.tsx

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,14 @@
11
import * as React from 'react';
22
import { View } from 'react-native';
33
import TestRenderer from 'react-test-renderer';
4-
import { configure, configureInternal, getConfig } from '../config';
4+
import { configureInternal, getConfig } from '../config';
55
import {
66
getHostComponentNames,
77
configureHostComponentNamesIfNeeded,
88
} from '../helpers/host-component-names';
99
import { act, render } from '..';
1010
import * as internalRenderer from '../renderer/renderer';
1111

12-
beforeEach(() => {
13-
configure({ renderer: 'internal' });
14-
});
15-
1612
describe('getHostComponentNames', () => {
1713
test('returns host component names from internal config', () => {
1814
configureInternal({

src/__tests__/screen.test.tsx

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
import * as React from 'react';
22
import { View, Text } from 'react-native';
3-
import { configure, render, screen } from '..';
4-
5-
beforeEach(() => {
6-
configure({ renderer: 'internal' });
7-
});
3+
import { render, screen } from '..';
84

95
test('screen has the same queries as render result', () => {
106
const result = render(<Text>Mt. Everest</Text>);

src/matchers/__tests__/extend-expect.test.tsx

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,7 @@ import * as React from 'react';
22
import { View } from 'react-native';
33

44
// Note: that must point to root of the /src to reliably replicate default import.
5-
import { configure, render } from '../..';
6-
7-
beforeEach(() => {
8-
configure({ renderer: 'internal' });
9-
});
5+
import { render } from '../..';
106

117
// This is check that RNTL does not extend "expect" by default, until we actually want to expose Jest matchers publically.
128
test('does not extend "expect" by default', () => {

src/matchers/__tests__/to-be-busy.test.tsx

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,8 @@
11
import * as React from 'react';
22
import { View } from 'react-native';
3-
import { configure, render, screen } from '../..';
3+
import { render, screen } from '../..';
44
import '../extend-expect';
55

6-
beforeEach(() => {
7-
configure({ renderer: 'internal' });
8-
});
9-
106
test('toBeBusy() basic case', () => {
117
render(
128
<>

src/matchers/__tests__/to-be-checked.test.tsx

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,8 @@
11
import React from 'react';
22
import { type AccessibilityRole, Switch, View } from 'react-native';
3-
import { render, screen, configure } from '../..';
3+
import { render, screen } from '../..';
44
import '../extend-expect';
55

6-
beforeEach(() => {
7-
configure({ renderer: 'internal' });
8-
});
9-
106
function renderViewsWithRole(role: AccessibilityRole) {
117
render(
128
<>

src/matchers/__tests__/to-be-disabled.test.tsx

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,9 @@ import {
1010
Text,
1111
View,
1212
} from 'react-native';
13-
import { configure, render, screen } from '../..';
13+
import { render, screen } from '../..';
1414
import '../extend-expect';
1515

16-
// beforeEach(() => {
17-
// configure({ renderer: 'internal' });
18-
// });
19-
2016
test('toBeDisabled()/toBeEnabled() supports basic case', () => {
2117
render(
2218
<View>

src/matchers/__tests__/to-be-empty-element.test.tsx

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React from 'react';
22
import { View } from 'react-native';
3-
import { configure, render, screen } from '../..';
3+
import { render, screen } from '../..';
44
import '../extend-expect';
55

66
// eslint-disable-next-line @typescript-eslint/no-unused-vars
@@ -9,10 +9,6 @@ function DoNotRenderChildren({ children }: { children: React.ReactNode }) {
99
return null;
1010
}
1111

12-
beforeEach(() => {
13-
configure({ renderer: 'internal' });
14-
});
15-
1612
test('toBeEmptyElement() base case', () => {
1713
render(
1814
<View testID="not-empty">

src/matchers/__tests__/to-be-expanded.test.tsx

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,8 @@
11
import * as React from 'react';
22
import { View } from 'react-native';
3-
import { configure, render, screen } from '../..';
3+
import { render, screen } from '../..';
44
import '../extend-expect';
55

6-
beforeEach(() => {
7-
configure({ renderer: 'internal' });
8-
});
9-
106
test('toBeExpanded() basic case', () => {
117
render(
128
<>

src/matchers/__tests__/to-be-on-the-screen.test.tsx

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,8 @@
11
import * as React from 'react';
22
import { View, Text } from 'react-native';
3-
import { configure, render, screen } from '../..';
3+
import { render, screen } from '../..';
44
import '../extend-expect';
55

6-
beforeEach(() => {
7-
configure({ renderer: 'internal' });
8-
});
9-
106
test('toBeOnTheScreen() example test', () => {
117
render(
128
<View>

0 commit comments

Comments
 (0)