import React from 'react'
import { render, waitForElement } from '@testing-library/react'
import ConditionalWrap from '../conditional-wrap'
describe('ConditionalWrap', () => {
it('wraps children if condition is met', async () => {
const { getByTestId, queryByTestId } = render(
{c}
}
>
)
await waitForElement(() => getByTestId('child'))
expect(queryByTestId('wrap')).toBeInTheDocument()
})
it('does NOT wrap children if condition is NOT met', async () => {
const { getByTestId, queryByTestId } = render(
{c}
}
>
)
await waitForElement(() => getByTestId('child'))
expect(queryByTestId('wrap')).not.toBeInTheDocument()
})
})