Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

test: make calendarSync OAuth-not-configured test hermetic

Adam Eivy5eb7f756ec93
diff --git a/server/services/calendarSync.test.js b/server/services/calendarSync.test.js
index 7d410cd411..bcffb8919c 100644
--- a/server/services/calendarSync.test.js
+++ b/server/services/calendarSync.test.js
@@ -7,6 +7,15 @@ vi.mock('./calendarAccounts.js', () => ({
mergeDiscoveredSubcalendars: vi.fn()
}));
+// Force the "no OAuth configured" path deterministically. Without this mock
+// the test reads the developer's REAL Google credentials/tokens off disk —
+// on a machine with credentials configured, the auth client materializes and
+// the sync fails later with a GaxiosError (400 invalid_grant) instead of the
+// 401 this test pins.
+vi.mock('./googleAuth.js', () => ({
+ getAuthenticatedClient: vi.fn(async () => null),
+}));
+
import { syncAccount } from './calendarSync.js';
import { mcpSyncAccount, mcpDiscoverCalendars } from './calendarGoogleSync.js';
import { apiSyncAccount, apiDiscoverCalendars } from './calendarGoogleApiSync.js';