import { render } from "@testing-library/react"; import React from "react"; import { componentDisplayName } from "../utils/componentDisplayName"; import { withOmit } from "./withOmit"; interface ExampleProps { a?: number; b?: number; c?: number; } function Example(props: ExampleProps): JSX.Element { return
{JSON.stringify(props)};
}
it("withOmit name", () => {
const Component = withOmit(["b"])(Example);
expect(componentDisplayName.get(Component)).toBe("withOmit.b(Example)");
});
it("withOmit", () => {
const Component = withOmit(["b"])(Example);
render({"a":1,"c":2}');
});