From 4d346751bfdd871bdc9e19fcc3c55ede078de2a4 Mon Sep 17 00:00:00 2001 From: lenhanphung Date: Thu, 9 Oct 2025 15:00:30 +0700 Subject: [PATCH] style: fix prettier --- .../features/Events/EventDisplay.test.tsx | 20 +++++++++++-------- .../features/Events/EventUpdateModal.test.tsx | 9 ++++----- 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/__test__/features/Events/EventDisplay.test.tsx b/__test__/features/Events/EventDisplay.test.tsx index 52461a7..0c40230 100644 --- a/__test__/features/Events/EventDisplay.test.tsx +++ b/__test__/features/Events/EventDisplay.test.tsx @@ -644,7 +644,7 @@ describe("Event Full Display", () => { // Use fixed timezone UTC for consistent test results across all environments // we provide a fixed timezone to enable exact value matching const fixedDate = new Date("2025-01-15T10:00:00.000Z"); // 10AM UTC - + const stateWithFixedDate = { ...preloadedState, calendars: { @@ -653,7 +653,9 @@ describe("Event Full Display", () => { ...preloadedState.calendars.list["667037022b752d0026472254/cal1"], events: { event1: { - ...preloadedState.calendars.list["667037022b752d0026472254/cal1"].events.event1, + ...preloadedState.calendars.list[ + "667037022b752d0026472254/cal1" + ].events.event1, start: fixedDate.toISOString(), end: new Date(fixedDate.getTime() + 3600000).toISOString(), timezone: "UTC", @@ -675,7 +677,7 @@ describe("Event Full Display", () => { ); expect(screen.getByDisplayValue("Test Event")).toBeInTheDocument(); - + // Verify datetime inputs with fixed timezone // Note: formatLocalDateTime converts to local browser time, so the exact hour may vary // We validate the format is correct rather than relaxing to meaningless patterns @@ -683,7 +685,9 @@ describe("Event Full Display", () => { expect(startInput).toBeInTheDocument(); expect(startInput).toHaveAttribute("type", "datetime-local"); // Validate proper datetime-local format (YYYY-MM-DDTHH:MM) without being too relaxed - expect(startInput.getAttribute("value")).toMatch(/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}$/); + expect(startInput.getAttribute("value")).toMatch( + /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}$/ + ); expect(screen.getByText("First Calendar")).toBeInTheDocument(); }); @@ -1284,7 +1288,7 @@ describe("Event Full Display", () => { // GIVEN user timezone is UTC+2 (Europe/Paris) // WHEN the user opens an event at 2PM UTC+7 (Asia/Bangkok) // THEN the event is displayed at 9AM UTC+2 (in local time format) - + const eventDateUTC7 = new Date("2025-01-15T07:00:00.000Z"); // 7AM UTC = 2PM UTC+7 const stateWithTimezone = { @@ -1327,7 +1331,7 @@ describe("Event Full Display", () => { // Verify title input field has the event title const titleInput = screen.getByDisplayValue("Timezone Test Event"); expect(titleInput).toBeInTheDocument(); - + // Verify the datetime input field exists const startInput = screen.getByLabelText("Start"); expect(startInput).toBeInTheDocument(); @@ -1338,7 +1342,7 @@ describe("Event Full Display", () => { // GIVEN user timezone is UTC+2 // WHEN the user edits an event at 2PM UTC+7 (Asia/Bangkok) // THEN the update modal displays the time as 2PM in Asia/Bangkok timezone - + const eventDateUTC7 = new Date("2025-01-15T07:00:00.000Z"); // 7AM UTC = 2PM UTC+7 const stateWithTimezone = { @@ -1380,7 +1384,7 @@ describe("Event Full Display", () => { // Verify the timezone select shows Asia/Bangkok fireEvent.click(screen.getByText("Show More")); - + // The timezone select should have Asia/Bangkok selected // Since the component uses formatLocalDateTime, the displayed time will be in local format // but the timezone selector should show Asia/Bangkok diff --git a/__test__/features/Events/EventUpdateModal.test.tsx b/__test__/features/Events/EventUpdateModal.test.tsx index 7c15fbc..3e7ebca 100644 --- a/__test__/features/Events/EventUpdateModal.test.tsx +++ b/__test__/features/Events/EventUpdateModal.test.tsx @@ -42,11 +42,11 @@ describe("EventUpdateModal Timezone Handling", () => { // GIVEN user timezone is UTC+2 // WHEN the user edits an event at 2PM UTC+7 (Asia/Bangkok) // THEN the update modal prompts him date with 2PM UTC+7 - + // Create event at 2PM UTC+7 (Asia/Bangkok) // 2PM UTC+7 = 14:00 in Bangkok = 07:00 UTC const eventDateUTC = new Date("2025-01-15T07:00:00.000Z"); - + const eventData = { uid: "test-event-1", title: "Timezone Event", @@ -95,7 +95,7 @@ describe("EventUpdateModal Timezone Handling", () => { const startInput = screen.getByLabelText("Start"); expect(startInput).toBeInTheDocument(); expect(startInput).toHaveAttribute("type", "datetime-local"); - + // The value should be formatted as 2025-01-15T14:00 (2PM in Bangkok time) // EventUpdateModal uses formatDateTimeInTimezone which formats in event's original timezone expect(startInput).toHaveValue("2025-01-15T14:00"); @@ -104,7 +104,7 @@ describe("EventUpdateModal Timezone Handling", () => { it("preserves original timezone when editing event fields", async () => { const eventDateUTC = new Date("2025-01-15T07:00:00.000Z"); - + const eventData = { uid: "test-event-2", title: "Original Event", @@ -151,4 +151,3 @@ describe("EventUpdateModal Timezone Handling", () => { expect(titleInput).toHaveValue("Updated Event"); }); }); -