import React from 'react';
import '@testing-library/jest-dom';
import { render, waitFor } from '@testing-library/react';
import { DelayedComponent } from '../delayed-component';
describe('DelayedComponent', () => {
it('should remove the component after the specified delay when initial state is true', async () => {
const { queryByText, getByText } = render(
Children
);
expect(getByText('Children')).toBeVisible();
await waitFor(() => {
expect(queryByText('Children')).toBeFalsy();
});
});
it('should render the component after the specified delay when initial state is false', async () => {
const { queryByText, getByText } = render(
Children
);
expect(queryByText('Children')).toBeFalsy();
await waitFor(() => {
expect(getByText('Children')).toBeVisible();
});
});
});