import * as React from 'react';
import { shallow } from 'enzyme';
import { cleanup } from 'react-testing-library';
import 'jest-styled-components';
import AnimatedLabel from "../components/AnimatedLabel/index";

beforeEach(cleanup);

describe("AnimatedLabel", () => {
    test("01 - automatic snapshot matching", () => {
        const onValueChange: (e) => void = jest.fn();
        const component = (
            <AnimatedLabel
                placeholder={'TESTING'}
                autosize={true}
                value={this.state.value}
                onValueChange={onValueChange}
            />
        );

        expect(component).toMatchSnapshot();
    });

    test("02 - component matches snapshot", () => {
        const onValueChange: (e) => void = jest.fn();
        const component = (
            <AnimatedLabel
                placeholder={'TESTING'}
                autosize={true}
                value={this.state.value}
                onValueChange={onValueChange}
            />
        )
        const wrapper = shallow(component);
        expect(wrapper.find({ placeholder: 'TESTING' }).exists()).toBe(true);
    });

});

