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