{"size": 1422, "ext": "js", "max_stars_repo_path": "src/components/counter.test.js", "max_stars_repo_name": "tapanpatra123/unit-testing", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/components/counter.test.js", "max_issues_repo_name": "tapanpatra123/unit-testing", "max_issues_repo_issues_event_min_datetime": "2021-10-06T20:03:06.000Z", "max_issues_repo_issues_event_max_datetime": "2022-02-27T08:07:37.000Z", "max_forks_repo_path": "src/components/counter.test.js", "max_forks_repo_name": "tapanpatra123/unit-testing", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": 3, "max_forks_count": null, "avg_line_length": 27.8823529412, "max_line_length": 85, "alphanum_fraction": 0.5872011252}
import React from 'react';
import { shallow, } from 'enzyme';
import Counter from './counter'
import { shallowToJson} from 'enzyme-to-json';

describe("Counter page",()=>{

    let wrapper;
    const props ={
        name : "Title Goes Here"
    }
    
    beforeEach(()=>{
        wrapper = shallow(<Counter {...props}/>)
    })

    it("to snapshot",()=>{
        expect(shallowToJson(wrapper)).toMatchSnapshot();
    })

    it("Receive props Name",()=>{
        const gotoText = wrapper.find("h1").text();
        expect(gotoText).toBe("Title Goes Here");
    })

    it("render the Default value of counter",()=>{
        const count = wrapper.find("h2");
        expect(count.text()).toBe('0');
    })
    
    it("render the click event of increment button and increment counter value",()=>{
        const buttoninCrement = wrapper.find('.increament');
        buttoninCrement.simulate('click');
        const count = wrapper.find("h2");
        expect(count.text()).toBe('1');
    })

    it("render the click event of decrrment button and decrement counter value",()=>{

        const buttoninCrement = wrapper.find('.increament');
        buttoninCrement.simulate('click');
        expect(wrapper.find("h2").text()).toBe('1');

        const buttonDecreament = wrapper.find('.decreament');
        buttonDecreament.simulate('click');
        expect(wrapper.find("h2").text()).toBe('0');
    })

    // it("")

})