test: add info widget component tests

This commit is contained in:
shamoon
2026-02-03 15:29:04 -08:00
parent 7df5aa9017
commit 3a6faa3f41
12 changed files with 508 additions and 0 deletions

View File

@@ -0,0 +1,20 @@
// @vitest-environment jsdom
import { screen } from "@testing-library/react";
import { describe, expect, it } from "vitest";
import { renderWithProviders } from "test-utils/render-with-providers";
import Greeting from "./greeting";
describe("components/widgets/greeting", () => {
it("renders nothing when text is not configured", () => {
const { container } = renderWithProviders(<Greeting options={{}} />, { settings: { target: "_self" } });
expect(container).toBeEmptyDOMElement();
});
it("renders configured greeting text", () => {
renderWithProviders(<Greeting options={{ text: "Hello there" }} />, { settings: { target: "_self" } });
expect(screen.getByText("Hello there")).toBeInTheDocument();
});
});