refactor: consolidate and debloat calendar sync implementation

Merge duplicated Google/Outlook engines, background handlers, and API
layers into shared calendarSync modules to cut complexity without changing
user-facing sync behavior.
This commit is contained in:
SethBurkart123
2026-06-28 10:45:45 +10:00
parent f4230e02b9
commit 7779edb063
52 changed files with 1965 additions and 3258 deletions
@@ -9,17 +9,22 @@ jest.mock("@/utils/verboseLog", () => ({
verboseLog: jest.fn(),
}));
jest.mock("@/seqta/utils/googleCalendar/storage", () => ({
eventMapKey: (origin: string, seqtaKey: string) => `${origin}::${seqtaKey}`,
readGoogleCalendarState: jest.fn(),
writeGoogleCalendarState: jest.fn(async (patch: unknown) => patch),
}));
jest.mock("@/seqta/utils/googleCalendar/storage", () => {
const actual = jest.requireActual<typeof import("@/seqta/utils/googleCalendar/storage")>(
"@/seqta/utils/googleCalendar/storage",
);
return {
...actual,
readGoogleCalendarState: jest.fn(),
writeGoogleCalendarState: jest.fn(async (patch: unknown) => patch),
};
});
jest.mock("@/seqta/utils/calendarSync/settings", () => ({
getSyncWeeksAhead: jest.fn(async () => 12),
}));
jest.mock("@/seqta/utils/googleCalendar/upsertEvent", () => ({
jest.mock("@/seqta/utils/calendarSync/remoteEvents", () => ({
upsertGoogleCalendarEvent: jest.fn(),
deleteGoogleCalendarEvent: jest.fn(),
}));
@@ -28,8 +33,8 @@ import { readGoogleCalendarState } from "@/seqta/utils/googleCalendar/storage";
import {
deleteGoogleCalendarEvent,
upsertGoogleCalendarEvent,
} from "@/seqta/utils/googleCalendar/upsertEvent";
import { deleteSyncedEventsFromGoogleCalendar, syncLessonsToGoogleCalendar } from "./syncEngine";
} from "@/seqta/utils/calendarSync/remoteEvents";
import { deleteSyncedEventsFromGoogleCalendar, syncLessonsToGoogleCalendar } from "@/seqta/utils/calendarSync/syncEngine";
const ORIGIN = "https://school.seqta.com.au";
const getAccessToken = async () => "test-token";