Skip to content

Commit d21fa31

Browse files
committed
Rename to TestRenderer like in https://reactjs.org/docs/test-renderer.html
1 parent 492219e commit d21fa31

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

packages/react-form-with-constraints-native/src/Native.test.tsx

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import * as React from 'react';
22
import { shallow } from 'enzyme';
33
import { StyleSheet } from 'react-native';
4-
import * as renderer from 'react-test-renderer';
4+
import * as TestRenderer from 'react-test-renderer';
55

66
import {
77
FormWithConstraints,
@@ -29,7 +29,7 @@ describe('FormWithConstraints', () => {
2929
describe('validate', () => {
3030
describe('validateFields()', () => {
3131
test('inputs', async () => {
32-
const wrapper = renderer.create(<SignUp />);
32+
const wrapper = TestRenderer.create(<SignUp />);
3333
const signUp = (wrapper.getInstance() as any) as SignUp;
3434
const emitValidateFieldEventSpy = jest.spyOn(signUp.form!, 'emitValidateFieldEvent');
3535

@@ -68,7 +68,7 @@ describe('FormWithConstraints', () => {
6868
});
6969

7070
test('field names', async () => {
71-
const wrapper = renderer.create(<SignUp />);
71+
const wrapper = TestRenderer.create(<SignUp />);
7272
const signUp = (wrapper.getInstance() as any) as SignUp;
7373
const emitValidateFieldEventSpy = jest.spyOn(signUp.form!, 'emitValidateFieldEvent');
7474

@@ -107,7 +107,7 @@ describe('FormWithConstraints', () => {
107107
});
108108

109109
test('inputs + field names', async () => {
110-
const wrapper = renderer.create(<SignUp />);
110+
const wrapper = TestRenderer.create(<SignUp />);
111111
const signUp = (wrapper.getInstance() as any) as SignUp;
112112
const emitValidateFieldEventSpy = jest.spyOn(signUp.form!, 'emitValidateFieldEvent');
113113

@@ -146,7 +146,7 @@ describe('FormWithConstraints', () => {
146146
});
147147

148148
test('without arguments', async () => {
149-
const wrapper = renderer.create(<SignUp />);
149+
const wrapper = TestRenderer.create(<SignUp />);
150150
const signUp = (wrapper.getInstance() as any) as SignUp;
151151
const emitValidateFieldEventSpy = jest.spyOn(signUp.form!, 'emitValidateFieldEvent');
152152

@@ -199,7 +199,7 @@ describe('FormWithConstraints', () => {
199199
});
200200

201201
test('change inputs', async () => {
202-
const wrapper = renderer.create(<SignUp />);
202+
const wrapper = TestRenderer.create(<SignUp />);
203203
const signUp = (wrapper.getInstance() as any) as SignUp;
204204
const emitValidateFieldEventSpy = jest.spyOn(signUp.form!, 'emitValidateFieldEvent');
205205

@@ -300,7 +300,7 @@ describe('FormWithConstraints', () => {
300300

301301
describe('validateFieldsWithoutFeedback()', () => {
302302
test('without arguments', async () => {
303-
const wrapper = renderer.create(<SignUp />);
303+
const wrapper = TestRenderer.create(<SignUp />);
304304
const signUp = (wrapper.getInstance() as any) as SignUp;
305305
const emitValidateFieldEventSpy = jest.spyOn(signUp.form!, 'emitValidateFieldEvent');
306306

@@ -367,7 +367,7 @@ describe('FormWithConstraints', () => {
367367
});
368368

369369
test('validateForm()', async () => {
370-
const wrapper = renderer.create(<SignUp />);
370+
const wrapper = TestRenderer.create(<SignUp />);
371371
const signUp = (wrapper.getInstance() as any) as SignUp;
372372
const validateFieldsWithoutFeedbackSpy = jest.spyOn(
373373
signUp.form!,
@@ -384,7 +384,7 @@ describe('FormWithConstraints', () => {
384384

385385
describe('normalizeInputs', () => {
386386
test('Multiple elements matching', async () => {
387-
const wrapper = renderer.create(
387+
const wrapper = TestRenderer.create(
388388
<FormWithConstraints>
389389
<TextInput name="username" />
390390
<FieldFeedbacks for="username" />
@@ -413,7 +413,7 @@ describe('FormWithConstraints', () => {
413413
});
414414

415415
test('Could not find field', async () => {
416-
const wrapper = renderer.create(
416+
const wrapper = TestRenderer.create(
417417
<FormWithConstraints>
418418
<TextInput name="username" />
419419
</FormWithConstraints>
@@ -430,7 +430,7 @@ describe('FormWithConstraints', () => {
430430
});
431431

432432
test('Could not find field - child with props undefined', async () => {
433-
const wrapper = renderer.create(
433+
const wrapper = TestRenderer.create(
434434
<FormWithConstraints>ChildWithPropsUndefined</FormWithConstraints>
435435
);
436436
const form = (wrapper.getInstance() as any) as FormWithConstraints;
@@ -447,7 +447,7 @@ describe('FormWithConstraints', () => {
447447

448448
describe('Async', () => {
449449
test('then', async () => {
450-
const wrapper = renderer.create(<SignUp />);
450+
const wrapper = TestRenderer.create(<SignUp />);
451451
const signUp = (wrapper.getInstance() as any) as SignUp;
452452
const emitValidateFieldEventSpy = jest.spyOn(signUp.form!, 'emitValidateFieldEvent');
453453

@@ -500,7 +500,7 @@ describe('FormWithConstraints', () => {
500500
});
501501

502502
test('catch', async () => {
503-
const wrapper = renderer.create(<SignUp />);
503+
const wrapper = TestRenderer.create(<SignUp />);
504504
const signUp = (wrapper.getInstance() as any) as SignUp;
505505
const emitValidateFieldEventSpy = jest.spyOn(signUp.form!, 'emitValidateFieldEvent');
506506

@@ -555,7 +555,7 @@ describe('FormWithConstraints', () => {
555555

556556
describe('resetFields()', () => {
557557
test('inputs', async () => {
558-
const wrapper = renderer.create(<SignUp />);
558+
const wrapper = TestRenderer.create(<SignUp />);
559559
const signUp = (wrapper.getInstance() as any) as SignUp;
560560

561561
signUp.setState({ username: 'john' });
@@ -636,7 +636,7 @@ describe('FieldFeedback', () => {
636636
{ for: 'username', stop: 'no' },
637637
{ form: form_username as any }
638638
);
639-
fieldFeedbacks_username.componentWillMount(); // Needed because of fieldsStore.addField() inside componentWillMount()
639+
fieldFeedbacks_username.componentDidMount(); // Needed because of fieldsStore.addField() inside componentDidMount()
640640
});
641641

642642
describe('render()', () => {
@@ -725,7 +725,7 @@ describe('FieldFeedback', () => {
725725
{ for: 'username', stop: 'no' },
726726
{ form: form as any }
727727
);
728-
fieldFeedbacks.componentWillMount(); // Needed because of fieldsStore.addField() inside componentWillMount()
728+
fieldFeedbacks.componentDidMount(); // Needed because of fieldsStore.addField() inside componentDidMount()
729729

730730
const wrapper = shallow(
731731
<FieldFeedback when={value => value.length === 0} theme={fieldFeedbackTheme}>

0 commit comments

Comments
 (0)