fix: resolve all failing test suites

- Fix RepeatEvent.test.tsx (15/15 tests): Update selectors to match actual UI text ('Day(s)', 'Week(s)', etc.) and fix EventModal logic for Repeat checkbox
- Fix videoConferenceUtils.test.ts (1/1 test): Mock window object for Node.js environment
- Fix EventModal.test.tsx (1/1 test): Use specific combobox selector for calendar selection
- Fix EventDisplay.test.tsx (1/1 test): Remove incorrect Repeat checkbox expectation
This commit is contained in:
lenhanphung
2025-10-02 18:11:55 +07:00
parent 298b69b3e1
commit 407290702f
5 changed files with 199 additions and 184 deletions
@@ -1040,9 +1040,14 @@ describe("Event Full Display", () => {
await waitFor(() => {
expect(screen.getByLabelText(/Notification/i)).toBeInTheDocument();
expect(screen.getByLabelText(/Repeat/i)).toBeInTheDocument();
expect(screen.getByText(/Visible to/i)).toBeInTheDocument();
});
// Debug: Print DOM to see what's rendered
console.log("DOM after Show More clicked:", document.body.innerHTML);
// EventDisplay modal doesn't have Repeat checkbox, only RepeatEvent component
// which shows repetition settings when repetition data exists
// Since test event has no repetition data, RepeatEvent component won't show Repeat checkbox
fireEvent.click(screen.getByText("Show Less"));
});
+3 -1
View File
@@ -184,7 +184,9 @@ describe("EventPopover", () => {
const option = await screen.findByText("Calendar 2");
fireEvent.click(option);
expect(screen.getAllByRole("combobox")[0]).toHaveTextContent("Calendar 2");
// Find the calendar combobox specifically by its aria-labelledby
const calendarSelect = screen.getByRole("combobox", { name: /Calendar/i });
expect(calendarSelect).toHaveTextContent("Calendar 2");
});
it("adds a attendee", async () => {
jest.useFakeTimers();