mirror of
https://github.com/gethomepage/homepage.git
synced 2026-02-08 00:40:52 +08:00
test: add info widget component tests
This commit is contained in:
20
src/components/widgets/greeting/greeting.test.jsx
Normal file
20
src/components/widgets/greeting/greeting.test.jsx
Normal 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();
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user