Skip to content

Commit

Permalink
Migrate SectionList-test to async jest/renderer create abstract…
Browse files Browse the repository at this point in the history
…ion (facebook#44999)

Summary:
Pull Request resolved: facebook#44999

Use `act`-wrapped abstraction for test rendering in preparation for this becoming mandatory.

Changelog: [Internal]

Reviewed By: yungsters

Differential Revision: D58651098
  • Loading branch information
robhogan authored and facebook-github-bot committed Jun 16, 2024
1 parent 5e2deda commit c6abb56
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions packages/react-native/Libraries/Lists/__tests__/SectionList-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,22 @@

'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(
<SectionList
sections={[]}
renderItem={({item}) => <item v={item.key} />}
/>,
);
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(
<SectionList
sections={[{key: 's1', data: [{key: 'i1'}, {key: 'i2'}]}]}
renderItem={({item}) => <item v={item.key} />}
Expand All @@ -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(
<SectionList
initialNumToRender={Infinity}
ItemSeparatorComponent={props => (
Expand Down Expand Up @@ -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(
<SectionList
sections={[{key: 's1', data: []}]}
renderItem={({item}) => <item v={item.key} />}
Expand All @@ -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(
<SectionList
sections={[{key: 's1', data: []}]}
renderItem={({item}) => <item v={item.key} />}
Expand Down

0 comments on commit c6abb56

Please sign in to comment.