Skip to content

Commit 0c8f3a8

Browse files
chore: update RNTL in example apps (#1691)
1 parent bc083af commit 0c8f3a8

10 files changed

+28
-18
lines changed

examples/basic/.eslintignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
jest-setup.ts

examples/basic/components/AnimatedView.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export function AnimatedView(props: AnimatedViewProps) {
1717
duration: props.fadeInDuration ?? 250,
1818
useNativeDriver: props.useNativeDriver ?? true,
1919
}).start();
20-
}, [fadeAnim]);
20+
}, [fadeAnim, props.fadeInDuration, props.useNativeDriver]);
2121

2222
return (
2323
<Animated.View

examples/basic/components/__tests__/AnimatedView.test.tsx

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import * as React from 'react';
2+
import { Text } from 'react-native';
13
import { act, render, screen } from '@testing-library/react-native';
24
import { AnimatedView } from '../AnimatedView';
35

@@ -13,7 +15,7 @@ describe('AnimatedView', () => {
1315
it('should use native driver when useNativeDriver is true', async () => {
1416
render(
1517
<AnimatedView fadeInDuration={250} useNativeDriver={true}>
16-
Test
18+
<Text>Test</Text>
1719
</AnimatedView>,
1820
);
1921
expect(screen.root).toHaveStyle({ opacity: 0 });
@@ -25,7 +27,7 @@ describe('AnimatedView', () => {
2527
it('should not use native driver when useNativeDriver is false', async () => {
2628
render(
2729
<AnimatedView fadeInDuration={250} useNativeDriver={false}>
28-
Test
30+
<Text>Test</Text>
2931
</AnimatedView>,
3032
);
3133
expect(screen.root).toHaveStyle({ opacity: 0 });

examples/basic/jest-setup.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1-
/* eslint-disable no-undef, import/no-extraneous-dependencies */
1+
import { configure } from '@testing-library/react-native';
22

33
// Import built-in Jest matchers
44
import '@testing-library/react-native/extend-expect';
55

66
// Silence the warning: Animated: `useNativeDriver` is not supported because the native animated module is missing
77
jest.mock('react-native/Libraries/Animated/NativeAnimatedHelper');
8+
9+
configure({ concurrentRoot: true });

examples/basic/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
},
2121
"devDependencies": {
2222
"@babel/core": "^7.24.0",
23-
"@testing-library/react-native": "^12.7.1",
23+
"@testing-library/react-native": "^12.8.0",
2424
"@types/eslint": "^8.56.10",
2525
"@types/jest": "^29.5.12",
2626
"@types/react": "~18.2.79",

examples/basic/yarn.lock

+5-5
Original file line numberDiff line numberDiff line change
@@ -2463,9 +2463,9 @@ __metadata:
24632463
languageName: node
24642464
linkType: hard
24652465

2466-
"@testing-library/react-native@npm:^12.7.1":
2467-
version: 12.7.1
2468-
resolution: "@testing-library/react-native@npm:12.7.1"
2466+
"@testing-library/react-native@npm:^12.8.0":
2467+
version: 12.8.0
2468+
resolution: "@testing-library/react-native@npm:12.8.0"
24692469
dependencies:
24702470
jest-matcher-utils: "npm:^29.7.0"
24712471
pretty-format: "npm:^29.7.0"
@@ -2478,7 +2478,7 @@ __metadata:
24782478
peerDependenciesMeta:
24792479
jest:
24802480
optional: true
2481-
checksum: 10c0/caaa4bdf97834b307b72af05c447ce40a2ba2ff40b464050bc29535caadf81981ea2873668445e633fdb3d13efccb136ef0932d6d9f4736bc6f7f98be98088d4
2481+
checksum: 10c0/216d40eefc3afa3259b37611213dcd6667cd0b8deb30521a8aaabe3afc15f07116ce64acba150f8c88b8e268df80639baf6bc38f05af1dbbae247e1d07639bde
24822482
languageName: node
24832483
linkType: hard
24842484

@@ -8923,7 +8923,7 @@ __metadata:
89238923
resolution: "root-workspace-0b6124@workspace:."
89248924
dependencies:
89258925
"@babel/core": "npm:^7.24.0"
8926-
"@testing-library/react-native": "npm:^12.7.1"
8926+
"@testing-library/react-native": "npm:^12.8.0"
89278927
"@types/eslint": "npm:^8.56.10"
89288928
"@types/jest": "npm:^29.5.12"
89298929
"@types/react": "npm:~18.2.79"

examples/cookbook/.eslintignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
test-utils.*
1+
jest-setup.ts
2+
test-utils.*

examples/cookbook/jest-setup.ts

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* eslint-disable no-undef, import/no-extraneous-dependencies */
1+
import { configure } from '@testing-library/react-native';
22

33
// Import built-in Jest matchers
44
import '@testing-library/react-native/extend-expect';
@@ -9,7 +9,11 @@ jest.mock('react-native/Libraries/Animated/NativeAnimatedHelper');
99

1010
// Enable API mocking via Mock Service Worker (MSW)
1111
beforeAll(() => server.listen());
12+
1213
// Reset any runtime request handlers we may add during the tests
1314
afterEach(() => server.resetHandlers());
15+
1416
// Disable API mocking after the tests are done
1517
afterAll(() => server.close());
18+
19+
configure({ concurrentRoot: true });

examples/cookbook/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
"devDependencies": {
3131
"@babel/core": "^7.20.0",
3232
"@expo/metro-runtime": "~3.2.3",
33-
"@testing-library/react-native": "^12.7.2",
33+
"@testing-library/react-native": "^12.8.0",
3434
"@types/eslint": "^8.56.10",
3535
"@types/jest": "^29.5.12",
3636
"@types/react": "~18.2.45",

examples/cookbook/yarn.lock

+5-5
Original file line numberDiff line numberDiff line change
@@ -2833,9 +2833,9 @@ __metadata:
28332833
languageName: node
28342834
linkType: hard
28352835

2836-
"@testing-library/react-native@npm:^12.7.2":
2837-
version: 12.7.2
2838-
resolution: "@testing-library/react-native@npm:12.7.2"
2836+
"@testing-library/react-native@npm:^12.8.0":
2837+
version: 12.8.0
2838+
resolution: "@testing-library/react-native@npm:12.8.0"
28392839
dependencies:
28402840
jest-matcher-utils: "npm:^29.7.0"
28412841
pretty-format: "npm:^29.7.0"
@@ -2848,7 +2848,7 @@ __metadata:
28482848
peerDependenciesMeta:
28492849
jest:
28502850
optional: true
2851-
checksum: 10c0/0e4e26bd211056646f8b5c80e9177efc90affe0ddc7e1a2c22742a4e6da7129ec1f9125c7d233adddeb27f429fb3eb91e3f3bfa9e77e176f042475574546b001
2851+
checksum: 10c0/216d40eefc3afa3259b37611213dcd6667cd0b8deb30521a8aaabe3afc15f07116ce64acba150f8c88b8e268df80639baf6bc38f05af1dbbae247e1d07639bde
28522852
languageName: node
28532853
linkType: hard
28542854

@@ -9762,7 +9762,7 @@ __metadata:
97629762
dependencies:
97639763
"@babel/core": "npm:^7.20.0"
97649764
"@expo/metro-runtime": "npm:~3.2.3"
9765-
"@testing-library/react-native": "npm:^12.7.2"
9765+
"@testing-library/react-native": "npm:^12.8.0"
97669766
"@types/eslint": "npm:^8.56.10"
97679767
"@types/jest": "npm:^29.5.12"
97689768
"@types/react": "npm:~18.2.45"

0 commit comments

Comments
 (0)