@crossed/ui
Version:
A universal & performant styling library for React Native, Next.js & React
34 lines (33 loc) • 1.28 kB
JavaScript
import { jsx } from "react/jsx-runtime";
import { render, screen } from "@crossed/test";
import { WeekDay } from "../WeekDay";
describe("WeekDay", () => {
const mockDays = [
{ date: new Date(2024, 0, 1) },
// January 1st
{ date: new Date(2024, 0, 2) },
// January 2nd
{ date: new Date(2024, 0, 3) }
// January 3rd
];
test("renders correctly with given days and locale", () => {
render(/* @__PURE__ */ jsx(WeekDay, { days: mockDays, locale: "en" }));
expect(screen.getByText("Mon")).toBeInTheDocument();
expect(screen.getByText("Tue")).toBeInTheDocument();
expect(screen.getByText("Wed")).toBeInTheDocument();
});
test("renders with a different locale", () => {
render(/* @__PURE__ */ jsx(WeekDay, { days: mockDays, locale: "fr" }));
expect(screen.getByText("Lun.")).toBeInTheDocument();
expect(screen.getByText("Mar.")).toBeInTheDocument();
expect(screen.getByText("Mer.")).toBeInTheDocument();
});
test("applies custom styles", () => {
render(/* @__PURE__ */ jsx(WeekDay, { days: mockDays, locale: "en" }));
const elements = screen.getAllByText(/Mon|Tue|Wed/);
elements.forEach((element) => {
expect(element).toBeInTheDocument();
});
});
});
//# sourceMappingURL=WeekDay.spec.js.map