Skip to content

Commit 9f09e69

Browse files
committed
chore: code review changes
1 parent 6b0ac90 commit 9f09e69

File tree

7 files changed

+10
-18
lines changed

7 files changed

+10
-18
lines changed

src/__tests__/__snapshots__/render.breaking.test.tsx.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Jest Snapshot v1, https://goo.gl/fbAQLP
22

3-
exports[`toJSON 1`] = `
3+
exports[`toJSON renders host output 1`] = `
44
<View
55
accessibilityState={
66
{

src/__tests__/__snapshots__/render.test.tsx.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Jest Snapshot v1, https://goo.gl/fbAQLP
22

3-
exports[`toJSON 1`] = `
3+
exports[`toJSON renders host output 1`] = `
44
<View
55
accessibilityState={
66
{

src/__tests__/render.breaking.test.tsx

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1+
/** This is a copy of regular tests with `useBreakingChanges` flag turned on. */
2+
13
/* eslint-disable no-console */
24
import * as React from 'react';
35
import { View, Text, TextInput, Pressable } from 'react-native';
46
import { render, screen, fireEvent, RenderAPI } from '..';
57
import { configureInternal } from '../config';
68

7-
type ConsoleLogMock = jest.Mock<typeof console.log>;
8-
99
beforeEach(() => {
1010
configureInternal({ useBreakingChanges: true });
1111
});
@@ -155,9 +155,8 @@ test('unmount should handle cleanup functions', () => {
155155
expect(cleanup).toHaveBeenCalledTimes(1);
156156
});
157157

158-
test('toJSON', () => {
158+
test('toJSON renders host output', () => {
159159
const { toJSON } = render(<MyButton>press me</MyButton>);
160-
161160
expect(toJSON()).toMatchSnapshot();
162161
});
163162

@@ -228,23 +227,14 @@ test('returns composite UNSAFE_root', () => {
228227
});
229228

230229
test('container displays deprecation', () => {
231-
jest.spyOn(console, 'warn').mockImplementation(() => {});
232-
const mockCalls = (console.warn as ConsoleLogMock).mock.calls;
233230
const view = render(<View testID="inner" />);
234231

235232
expect(() => view.container).toThrowErrorMatchingInlineSnapshot(
236233
`"'container' property has been renamed to 'UNSAFE_root'"`
237234
);
238-
expect(mockCalls[0][0]).toMatchInlineSnapshot(
239-
`"'container' property has been renamed to 'UNSAFE_root'"`
240-
);
241-
242235
expect(() => screen.container).toThrowErrorMatchingInlineSnapshot(
243236
`"'container' property has been renamed to 'UNSAFE_root'"`
244237
);
245-
expect(mockCalls[1][0]).toMatchInlineSnapshot(
246-
`"'container' property has been renamed to 'UNSAFE_root'"`
247-
);
248238
});
249239

250240
test('RenderAPI type', () => {

src/__tests__/render.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ test('unmount should handle cleanup functions', () => {
148148
expect(cleanup).toHaveBeenCalledTimes(1);
149149
});
150150

151-
test('toJSON', () => {
151+
test('toJSON renders host output', () => {
152152
const { toJSON } = render(<MyButton>press me</MyButton>);
153153

154154
expect(toJSON()).toMatchSnapshot();

src/queries/__tests__/displayValue.breaking.test.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
/** This is a copy of regular tests with `useBreakingChanges` flag turned on. */
2+
13
import * as React from 'react';
24
import { View, TextInput } from 'react-native';
35

src/queries/__tests__/placeholderText.breaking.test.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
/** This is a copy of regular test with `useBreakingChanges` flag turned on. */
2+
13
import * as React from 'react';
24
import { View, TextInput } from 'react-native';
35
import { render } from '../..';

src/render.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,8 +116,6 @@ function buildRenderResult(
116116
return instance;
117117
}
118118

119-
// eslint-disable-next-line no-console
120-
console.warn(`'container' property has been renamed to 'UNSAFE_root'`);
121119
throw new Error("'container' property has been renamed to 'UNSAFE_root'");
122120
},
123121
};

0 commit comments

Comments
 (0)