Files
HiveGrid-Wireframes/hivegrid-cloud/apps/web/app/components/ui/input/InputCheckboxCards.test.tsx
T

28 lines
692 B
TypeScript

import { render } from "@testing-library/react";
import { describe, expect, it, vi } from "vitest";
import InputCheckboxCards from "./InputCheckboxCards";
vi.mock("react-i18next", () => ({
useTranslation: () => ({ t: (key: string) => key }),
}));
describe("InputCheckboxCards", () => {
it("does not mutate the incoming value array while comparing selections", () => {
const value = ["beta", "alpha"];
render(
<InputCheckboxCards
options={[
{ name: "Alpha", value: "alpha" },
{ name: "Beta", value: "beta" },
]}
value={value}
onChange={vi.fn()}
/>,
);
expect(value).toEqual(["beta", "alpha"]);
});
});