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
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
fix: import afterEach and move fetch stub to beforeEach/afterEach lifecycle
Adam Eivy84f69793c1c5
diff --git a/server/services/instances.test.js b/server/services/instances.test.jsindex 7d1106e8d8..de69d44a1b 100644--- a/server/services/instances.test.js+++ b/server/services/instances.test.js@@ -1,4 +1,4 @@-import { describe, it, expect, vi, beforeEach } from 'vitest';+import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';// Mock dependencies before importing the modulevi.mock('fs/promises', () => ({@@ -32,8 +32,7 @@ vi.mock('../lib/ports.js', () => ({DEFAULT_PEER_PORT: 5555}));-// Mock global fetch-vi.stubGlobal('fetch', vi.fn());+// fetch is stubbed per-test in beforeEach and restored in afterEachimport { readJSONFile } from '../lib/fileUtils.js';import { instanceEvents } from './instanceEvents.js';@@ -59,12 +58,14 @@ describe('instances.js', () => {beforeEach(() => {vi.clearAllMocks();vi.useFakeTimers();+ vi.stubGlobal('fetch', vi.fn());readJSONFile.mockResolvedValue({ self: null, peers: [] });});afterEach(() => {stopPolling();vi.useRealTimers();+ vi.unstubAllGlobals();});// --- Self Identity ---