Skip to content

Commit e15d326

Browse files
committed
.
1 parent ebf9df1 commit e15d326

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/__tests__/fire-event.test.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -642,7 +642,7 @@ describe('React.Suspense integration', () => {
642642
});
643643
});
644644

645-
test('should handle unmounted elements gracefully in async mode', async () => {
645+
test('should handle unmounted elements gracefully', async () => {
646646
const onPress = jest.fn();
647647
await render(
648648
<TouchableOpacity onPress={onPress}>
@@ -651,7 +651,7 @@ test('should handle unmounted elements gracefully in async mode', async () => {
651651
);
652652

653653
const element = screen.getByText('Test');
654-
await screen.unmount();
654+
await screen.rerender(<View />);
655655

656656
// Firing async event on unmounted element should not crash
657657
await fireEvent.press(element);

src/__tests__/unsafe-fire-event-sync.test.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -566,14 +566,14 @@ describe('native events', () => {
566566

567567
test('should handle unmounted elements gracefully', () => {
568568
const onPress = jest.fn();
569-
const { unmount } = unsafe_renderSync(
569+
const { rerender } = unsafe_renderSync(
570570
<TouchableOpacity onPress={onPress}>
571571
<Text>Test</Text>
572572
</TouchableOpacity>,
573573
);
574574

575575
const element = screen.getByText('Test');
576-
unmount();
576+
rerender(<View />);
577577

578578
// Firing event on unmounted element should not crash
579579
unsafe_fireEventSync.press(element);

0 commit comments

Comments
 (0)