import { NodeRef, Unstable_NestingAuto as NestingAuto } from '@fluentui/react-component-nesting-registry'; import { mount } from 'enzyme'; import * as React from 'react'; describe('NestingAuto', () => { describe('children', () => { it('renders components based on present context', () => { const wrapper = mount({() => {() =>
}}); expect(wrapper.childAt(0).is('NestingRoot')).toBe(true); // => => => expect( wrapper .childAt(0) .childAt(0) .childAt(0) .is('NestingChild'), ).toBe(true); }); it('is a render function', () => { const children = jest.fn().mockImplementation((_, ref: NodeRef) =>
); mount({children}); const getRefs = children.mock.calls[0][0]; expect(children).toBeCalledWith( expect.any(Function), expect.objectContaining({ current: expect.objectContaining({ tagName: 'DIV' }) }), ); expect(getRefs()).toEqual( expect.arrayContaining([ expect.objectContaining({ current: expect.objectContaining({ tagName: 'DIV' }), }), ]), ); }); }); });