From 9435097b160fdb04bb642f9a7fa451067f708ac4 Mon Sep 17 00:00:00 2001 From: Rob Hogan Date: Sun, 16 Jun 2024 16:55:21 -0700 Subject: [PATCH] Migrate `SectionList-test` to async `jest/renderer` `create` abstraction (#44999) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/44999 Use `act`-wrapped abstraction for test rendering in preparation for this becoming mandatory. Changelog: [Internal] Reviewed By: yungsters Differential Revision: D58651098 fbshipit-source-id: d797c792b1f6ac155f02951a8264cf0631961d83 --- .../Lists/__tests__/SectionList-test.js | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/packages/react-native/Libraries/Lists/__tests__/SectionList-test.js b/packages/react-native/Libraries/Lists/__tests__/SectionList-test.js index 9eb6e340e30..26cca6c1649 100644 --- a/packages/react-native/Libraries/Lists/__tests__/SectionList-test.js +++ b/packages/react-native/Libraries/Lists/__tests__/SectionList-test.js @@ -10,13 +10,13 @@ 'use strict'; +import {create} from '../../../jest/renderer'; import SectionList from '../SectionList'; import * as React from 'react'; -import ReactTestRenderer from 'react-test-renderer'; describe('SectionList', () => { - it('renders empty list', () => { - const component = ReactTestRenderer.create( + it('renders empty list', async () => { + const component = await create( } @@ -24,8 +24,8 @@ describe('SectionList', () => { ); expect(component).toMatchSnapshot(); }); - it('rendering empty section headers is fine', () => { - const component = ReactTestRenderer.create( + it('rendering empty section headers is fine', async () => { + const component = await create( } @@ -34,8 +34,8 @@ describe('SectionList', () => { ); expect(component).toMatchSnapshot(); }); - it('renders all the bells and whistles', () => { - const component = ReactTestRenderer.create( + it('renders all the bells and whistles', async () => { + const component = await create( ( @@ -75,8 +75,8 @@ describe('SectionList', () => { ); expect(component).toMatchSnapshot(); }); - it('renders a footer when there is no data', () => { - const component = ReactTestRenderer.create( + it('renders a footer when there is no data', async () => { + const component = await create( } @@ -86,8 +86,8 @@ describe('SectionList', () => { ); expect(component).toMatchSnapshot(); }); - it('renders a footer when there is no data and no header', () => { - const component = ReactTestRenderer.create( + it('renders a footer when there is no data and no header', async () => { + const component = await create( }