diff --git a/src/app/(main)/dashboard/components/Calendar/Calendar.test.tsx b/src/app/(main)/dashboard/components/Calendar/Calendar.test.tsx new file mode 100644 index 00000000..f920887a --- /dev/null +++ b/src/app/(main)/dashboard/components/Calendar/Calendar.test.tsx @@ -0,0 +1,27 @@ +import { render } from "@testing-library/react"; +import { Provider } from "react-redux"; +import { configureStore } from "@reduxjs/toolkit"; +import { format } from "date-fns"; +import Calendar from "./Calendar"; +import { rootReducer } from "@/store/store"; + +describe("Calendar Component", () => { + // not the best test. maybe refactor to e2e test later + it("displays the month and year on a single line", () => { + const store = configureStore({ + reducer: rootReducer, + }); + + const { getByText } = render( + + + , + ); + + const currentDate = new Date(); + const formattedDate = format(currentDate, "MMMM y"); + const monthYearElement = getByText(formattedDate); + + expect(monthYearElement.closest("div")).toHaveClass("whitespace-nowrap"); + }); +}); diff --git a/src/app/(main)/dashboard/components/Calendar/Calendar.tsx b/src/app/(main)/dashboard/components/Calendar/Calendar.tsx index a6cbfaef..de2c5b63 100644 --- a/src/app/(main)/dashboard/components/Calendar/Calendar.tsx +++ b/src/app/(main)/dashboard/components/Calendar/Calendar.tsx @@ -50,7 +50,7 @@ export default function Calendar({ {/* CALENDAR */}
-
+
{/* CALENDAR CONTROLS */}