import { test, expect } from 'vitest'; import { render, screen } from '@testing-library/react'; import ConditionalWrapper from './ConditionalWrapper'; test('conditional wrapper true', () => { render( {children}} > Bar ); const element = screen.getByTestId('testContent'); const elementParent = screen.getByTestId('wrapper'); expect(element).toBeInTheDocument(); expect(elementParent).toBeInTheDocument(); expect(element.parentElement).toEqual(elementParent) }); test('conditional wrapper false', () => { render( {children}} > Bar ); const element = screen.getByTestId('testContent'); const elementParent = screen.queryByTestId('wrapper'); expect(element).toBeInTheDocument(); expect(elementParent).not.toBeInTheDocument(); });