fix: update test cases for Menubar and Calendar components
- Update Menubar test cases to match component changes (logo instead of text) - Add required currentView prop to all Menubar test cases - Fix Calendar test cases by adding calendarRef wrapper component - Convert babel.config.ts to babel.config.js for Node.js 24 compatibility - All 146 tests now pass successfully
This commit is contained in:
@@ -3,6 +3,7 @@ import CalendarApp from "../../src/components/Calendar/Calendar";
|
||||
import * as eventThunks from "../../src/features/Calendars/CalendarSlice";
|
||||
import { renderWithProviders } from "../utils/Renderwithproviders";
|
||||
import { searchUsers } from "../../src/features/User/userAPI";
|
||||
import { useRef } from "react";
|
||||
|
||||
import userEvent from "@testing-library/user-event";
|
||||
jest.mock("../../src/features/User/userAPI");
|
||||
@@ -10,6 +11,12 @@ const mockedSearchUsers = searchUsers as jest.MockedFunction<
|
||||
typeof searchUsers
|
||||
>;
|
||||
|
||||
// Test wrapper component to provide calendarRef
|
||||
function CalendarTestWrapper() {
|
||||
const calendarRef = useRef(null);
|
||||
return <CalendarApp calendarRef={calendarRef} />;
|
||||
}
|
||||
|
||||
describe("CalendarSelection", () => {
|
||||
const today = new Date();
|
||||
const start = new Date(today);
|
||||
@@ -208,7 +215,7 @@ describe("calendar Availability search", () => {
|
||||
},
|
||||
]);
|
||||
|
||||
renderWithProviders(<CalendarApp />, preloadedState);
|
||||
renderWithProviders(<CalendarTestWrapper />, preloadedState);
|
||||
|
||||
const input = screen.getByPlaceholderText(/search user/i);
|
||||
userEvent.type(input, "New");
|
||||
@@ -233,7 +240,7 @@ describe("calendar Availability search", () => {
|
||||
.mockImplementation((payload) => {
|
||||
return () => Promise.resolve(payload) as any;
|
||||
});
|
||||
renderWithProviders(<CalendarApp />, preloadedState);
|
||||
renderWithProviders(<CalendarTestWrapper />, preloadedState);
|
||||
|
||||
const input = screen.getByPlaceholderText(/search user/i);
|
||||
userEvent.type(input, "Alice");
|
||||
|
||||
Reference in New Issue
Block a user