import React from 'react';
import { render, fireEvent, cleanup } from '@testing-library/react';
import Sidebar from './Sidebar';

afterEach(cleanup);

const SideBarProps = {
    viewSideBar: true,
    onChange: jest.fn(),
};

describe('Sidebar', () => {
    it('render Sidebar when viewSideBar is true', () => {
        const { getByTestId, getByAltText } = render(<Sidebar {...SideBarProps} />);
        fireEvent.click(getByAltText('sideBarImage'));
        expect(getByTestId('sideBar')).toBeInTheDocument();
    });
});
