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

describe("Error Component", () => {
  const props: ErrorProps = {
    dataTestId: "test-id",
    children: "Error message",
    className: "custom-error-class",
    direction: "start",
    id: "error-id",
    style: { color: "red" },
  };

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

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