import * as React from 'react'; import { render, screen } from '@testing-library/react'; import { CoreAdmin } from './CoreAdmin'; import { Resource } from './Resource'; describe('CoreAdmin', () => { describe('children', () => { it('should accept Resources as children', async () => { const Foo = () =>
Foo
; const App = () => ( ); render(); await screen.findByText('Foo'); }); it('should accept a function returning an array of Resources as children', async () => { const Foo = () =>
Foo
; const App = () => ( {() => [ , , ]} ); render(); await screen.findByText('Foo'); }); it('should accept a function returning a fragment of Resources as children', async () => { const Foo = () =>
Foo
; const App = () => ( {() => ( <> )} ); render(); await screen.findByText('Foo'); }); it('should accept a function returning a promise for an array of Resources as children', async () => { const Foo = () =>
Foo
; const App = () => ( {() => Promise.resolve([ , , ]) } ); render(); await screen.findByText('Foo'); }); it('should accept a function returning a promise for a fragment of Resources as children', async () => { const Foo = () =>
Foo
; const App = () => ( {() => Promise.resolve( <> ) } ); render(); await screen.findByText('Foo'); }); }); });