+ {this.state.error?.message || 'An unexpected error occurred'} +
++ {this.state.error?.message || + "An unexpected error occurred in the calendar"} +
+ +
+ {this.state.error?.stack}
+ {"\n\n"}
+ {this.state.errorInfo.componentStack}
+
+ + {error.message} +
+ ++ Testing new calendar implementation +
+
+ {JSON.stringify(
+ {
+ selectedDate: selectedDate.toISOString(),
+ visibleCalendarIds,
+ calendarCount: calendars.length,
+ eventCount: events.length,
+ isFetching,
+ },
+ null,
+ 2,
+ )}
+
+
{format(event.displayStart, "yyyy-M-d")} -{" "}
{format(event.displayEnd, "yyyy-M-d")}
diff --git a/apps/web/src/components/Calendar/__tests__/CalendarPageV2.integration.test.tsx b/apps/web/src/components/Calendar/__tests__/CalendarPageV2.integration.test.tsx
new file mode 100644
index 00000000..dcda666a
--- /dev/null
+++ b/apps/web/src/components/Calendar/__tests__/CalendarPageV2.integration.test.tsx
@@ -0,0 +1,295 @@
+/**
+ * Integration tests for CalendarPageV2
+ *
+ * These tests use real RxDB with schema validation to catch runtime errors
+ * that mocked tests miss.
+ */
+
+import { describe, it, expect, beforeEach, afterEach, vi } from "vitest";
+import { render, screen, waitFor } from "@testing-library/react";
+import { createRxDatabase, addRxPlugin, RxDatabase } from "rxdb";
+import { getRxStorageMemory } from "rxdb/plugins/storage-memory";
+import { RxDBDevModePlugin } from "rxdb/plugins/dev-mode";
+import { Provider as RxDBProvider } from "rxdb-hooks";
+import CalendarPageV2 from "../CalendarPageV2";
+import {
+ calendarEventsSchemaV0,
+ calendarsSchemaV0,
+} from "@/config/rxdb-calendar-v2";
+
+// Enable dev mode for better error messages
+if (process.env.NODE_ENV !== "production") {
+ addRxPlugin(RxDBDevModePlugin);
+}
+
+describe("CalendarPageV2 Integration Tests", () => {
+ let db: RxDatabase;
+
+ beforeEach(async () => {
+ // Create a real RxDB instance with memory storage
+ db = await createRxDatabase({
+ name: "test-calendar-db-" + Date.now(),
+ storage: getRxStorageMemory(),
+ });
+
+ // Add collections with real schemas (this will catch schema validation errors)
+ await db.addCollections({
+ calendar_events: {
+ schema: calendarEventsSchemaV0,
+ },
+ calendars: {
+ schema: calendarsSchemaV0,
+ },
+ });
+ });
+
+ afterEach(async () => {
+ if (db) {
+ await db.destroy();
+ }
+ });
+
+ describe("Default Calendar Creation", () => {
+ it("should create default calendar with all required fields", async () => {
+ const TestComponent = () => (
+ Calendar
+
+ {getDateLabel()}
+
+
+ {format(miniCalendarDate, "MMMM yyyy")}
+
+ My Calendars
+
+ {dateKey}
+
+