fix test case

This commit is contained in:
lenhanphung
2025-10-06 17:46:02 +07:00
committed by Benoit TELLIER
parent 42c953ccf9
commit 202feb3d23
@@ -660,8 +660,8 @@ describe("Event Full Display", () => {
// Check that event title is displayed // Check that event title is displayed
expect(screen.getAllByText("Test Event")).toHaveLength(2); expect(screen.getAllByText("Test Event")).toHaveLength(2);
// Check that event time is displayed // Check that event time is displayed (use more flexible pattern)
expect(screen.getByText(/2025-10-06T17:/)).toBeInTheDocument(); expect(screen.getByText(/2025-10-06T\d{2}:/)).toBeInTheDocument();
expect(screen.getByText("First Calendar")).toBeInTheDocument(); expect(screen.getByText("First Calendar")).toBeInTheDocument();
}); });
@@ -1016,6 +1016,10 @@ describe("Event Full Display", () => {
/>, />,
preloadedState preloadedState
); );
// Initially should show "Show More" button
expect(screen.getByText("Show More")).toBeInTheDocument();
act(() => { act(() => {
fireEvent.click(screen.getByText("Show More")); fireEvent.click(screen.getByText("Show More"));
}); });
@@ -1024,8 +1028,8 @@ describe("Event Full Display", () => {
expect(screen.getByLabelText(/Notification/i)).toBeInTheDocument(); expect(screen.getByLabelText(/Notification/i)).toBeInTheDocument();
}); });
// Debug: Print DOM to see what's rendered // After clicking, should show "Show Less" button
console.log("DOM after Show More clicked:", document.body.innerHTML); expect(screen.getByText("Show Less")).toBeInTheDocument();
// EventDisplay modal doesn't have Repeat checkbox, only RepeatEvent component // EventDisplay modal doesn't have Repeat checkbox, only RepeatEvent component
// which shows repetition settings when repetition data exists // which shows repetition settings when repetition data exists
@@ -1105,7 +1109,7 @@ describe("Event Full Display", () => {
expect(screen.getAllByText("Test Event")).toHaveLength(2); expect(screen.getAllByText("Test Event")).toHaveLength(2);
// Check that event time is displayed (use a more flexible regex) // Check that event time is displayed (use a more flexible regex)
expect(screen.getByText(/2025-10-06T17:/)).toBeInTheDocument(); expect(screen.getByText(/2025-10-06T\d{2}:/)).toBeInTheDocument();
}); });
it("displays event with multiple calendars", () => { it("displays event with multiple calendars", () => {
const day = new Date(); const day = new Date();