{"size": 1542, "ext": "js", "max_stars_repo_path": "src/common-ui/auto-complete/select/__test__/select.test.js", "max_stars_repo_name": "yuriilychak/dungeon-editor", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/common-ui/auto-complete/select/__test__/select.test.js", "max_issues_repo_name": "yuriilychak/dungeon-editor", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/common-ui/auto-complete/select/__test__/select.test.js", "max_forks_repo_name": "yuriilychak/dungeon-editor", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 23.3636363636, "max_line_length": 77, "alphanum_fraction": 0.4974059663}
import React from "react";
import { createMount } from "@material-ui/core/test-utils";

import Select from "../select";

jest.mock("@material-ui/core/MenuItem", () => props => (<div {...props} />));

describe("Select test",()=> {
    const defaultProps = {
        getMenuProps: jest.fn(),
        getItemProps: jest.fn(),
        suggestions: [
            {
                item: "test"
            }
        ],
        inputValue: "test",
        isOpen: true,
        showEmpty: true,
        highlightedIndex: 0
    };

    const wrapper = createMount()(
        <Select {...defaultProps} />
    );


    it("Default snapshot", () => {
        expect(wrapper.html()).toMatchSnapshot();
    });

    it("Snapshot closed", () => {
        wrapper.setProps({
            ...defaultProps,
            isOpen: false
        });

        expect(wrapper.html()).toMatchSnapshot();
    });

    it("Snapshot without show empty", () => {
        wrapper.setProps({
            ...defaultProps,
            showEmpty: false
        });
        expect(wrapper.html()).toMatchSnapshot();
    });

    it("Snapshot with empty input", () => {
        wrapper.setProps({
            ...defaultProps,
            inputValue: ""
        });
        expect(wrapper.html()).toMatchSnapshot();
    });

    it("Snapshot with empty input and without show empty", () => {
        wrapper.setProps({
            ...defaultProps,
            inputValue: "",
            showEmpty: false
        });
        expect(wrapper.html()).toMatchSnapshot();
    });
});
