/**
 * @jest-environment jsdom
 */
import React from 'react';
import renderer from 'react-test-renderer';
import AlertMessage, { AlertType } from '../AlertMessage';

describe('snapshot test - testing AlertMessage Component', () => {

    it('renders nothing when show props is false', () => {
        const item = renderer.create(<AlertMessage show={false} type={AlertType.DANGER} message="test message"/>).toJSON();
        expect(item).toMatchSnapshot();
    });

    it('renders correctly when show props is true', () => {
        const item = renderer.create(<AlertMessage show={true} type={AlertType.DANGER} message="error message" showAlertLabel={true}/>).toJSON();
        expect(item).toMatchSnapshot();
    });

    it('renders children props when we have both message props and children props', () => {
        const item = renderer.create(<AlertMessage show={true} type={AlertType.DANGER} message="test message" showAlertLabel={true}><div>child element</div></AlertMessage>).toJSON();
        expect(item).toMatchSnapshot();
    });

});
