import { test, expect } from "vitest"; import React from "react"; import { render } from "@testing-library/react"; import SketchAttributesCard from "./SketchAttributesCard.js"; import { ReportContext } from "../context/index.js"; test("SketchAttributesCard renders all userAttributes", () => { const { getAllByText } = render( , ); expect(getAllByText("Field 1").length).toBe(1); expect(getAllByText("Number").length).toBe(1); }); test("Can deal with null values", () => { const { getAllByText } = render( , ); expect(getAllByText("Field 1").length).toBe(1); expect(getAllByText("Number").length).toBe(1); }); test("SketchAttributesCard autoHide option hides card if there are no attributes", () => { const { getAllByText } = render( , ); expect(() => getAllByText("Attributes")).toThrow(/Unable to find/); render( , ); expect(getAllByText("Attributes").length).toBe(1); render( , ); expect(getAllByText("Attributes").length).toBe(2); });