import React from "react";
import { render } from "@testing-library/react";
import "@testing-library/jest-dom";
import { TreeViewProps } from "../TreeViewProps";
import TreeView from "../TreeView";

describe("TreeView Component", () => {
  const props: TreeViewProps = {
    dataTestId: "test-id",
    animate: true,
    "aria-label": "aria-label-text",
    "aria-labelledby": "aria-labelledby-text",
    "aria-multiselectable": true,
    checkboxes: false,
    checkField: "checked",
    checkIndeterminateField: "checkIndeterminate",
    childrenField: "children",
    className: "treeview-class",
    data: [],
    dir: "ltr",
    disableField: "disabled",
    draggable: false,
    expandField: "expanded",
    expandIcons: false,
    focusIdField: "focusId",
    hasChildrenField: "hasChildren",
    item: (props) => <div>{props.item.text}</div>,
    selectField: "selected",
    size: "medium",
    tabIndex: 0,
    textField: "text",
  };

  it("renders all props correctly", () => {
    render(<TreeView {...props} />);
  });

  it("matches the snapshot", () => {
    const { asFragment } = render(<TreeView {...props} />);
    expect(asFragment()).toMatchSnapshot();
  });
});
