mirror of
https://github.com/nextui-org/nextui.git
synced 2025-12-08 19:26:11 +00:00
* feat: tailwind variants upgrade * chore: restore npmrc * chore: adjust pkgs * fix: versions * fix: lock file * chore(changeset): update package name * chore(deps): use fixed version * fix(test): incorrect package name --------- Co-authored-by: աӄա <wingkwong.code@gmail.com>
33 lines
850 B
TypeScript
33 lines
850 B
TypeScript
import * as React from "react";
|
|
import {render} from "@testing-library/react";
|
|
import {spy, shouldIgnoreReactWarning} from "@heroui/test-utils";
|
|
|
|
import {Code} from "../src";
|
|
|
|
describe("Code", () => {
|
|
it("should render correctly", () => {
|
|
const wrapper = render(<Code />);
|
|
|
|
expect(() => wrapper.unmount()).not.toThrow();
|
|
|
|
if (shouldIgnoreReactWarning(spy)) {
|
|
return;
|
|
}
|
|
|
|
expect(spy).toHaveBeenCalledTimes(0);
|
|
});
|
|
|
|
it("ref should be forwarded", () => {
|
|
const ref = React.createRef<HTMLDivElement>();
|
|
|
|
render(<Code ref={ref} />);
|
|
expect(ref.current).not.toBeNull();
|
|
});
|
|
|
|
it("should include the code", () => {
|
|
const wrapper = render(<Code data-testid="code-test">npm install @heroui/react</Code>);
|
|
|
|
expect(wrapper.getByTestId("code-test")).toHaveTextContent("npm install @heroui/react");
|
|
});
|
|
});
|