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: reset backup readdir fixture between suites

[._.]/ Adam Eivy9b696fd48930
diff --git a/server/services/backup.test.js b/server/services/backup.test.js
index a73e4e146a..985ec5976a 100644
--- a/server/services/backup.test.js
+++ b/server/services/backup.test.js
@@ -745,6 +745,13 @@ describe('restorePostgres', () => {
};
beforeEach(async () => {
vi.clearAllMocks();
+ // listSnapshots installs a persistent readdir spy that returns Dirents.
+ // Restore string-returning filesystem reads before Windows ENOENT handling
+ // checks for an atomic-write swap sibling.
+ const realFs = await vi.importActual('fs/promises');
+ if (vi.isMockFunction(fs.readdir)) {
+ fs.readdir.mockImplementation((...args) => realFs.readdir(...args));
+ }
// clearAllMocks does not undo stubEnv — a PGPASSWORD stub from a failed
// (thrown) test would otherwise leak into every test after it.
vi.unstubAllEnvs();