import { renderHook } from "@testing-library/react";
import assert from "node:assert/strict";
import { describe, it } from "node:test";
import { useCN } from "./useCN";

describe("useCN", () => {
  it("recomputes classnames when baseClass changes", () => {
    const { result, rerender } = renderHook((props: { baseClass: string; }) => useCN(props.baseClass), {
      initialProps: { baseClass: "first" },
    });

    assert.strictEqual(result.current.getCN("item"), "first__item");

    rerender({ baseClass: "second" });

    assert.strictEqual(result.current.getCN("item"), "second__item");
  });
});
