diff --git a/src/db/locator.ts b/src/db/locator.ts index d46f085..492c73d 100644 --- a/src/db/locator.ts +++ b/src/db/locator.ts @@ -36,6 +36,8 @@ export function getDb(): Database { if (!testScope) testScope = new AsyncLocalStorage(); const scoped = testScope.getStore(); if (scoped) return scoped; + // En tests, no hacer fallback al currentDb global para evitar fugas entre suites + throw new DbNotConfiguredError('Database has not been configured. Call setDb(db) before using getDb().'); } if (currentDb) return currentDb; throw new DbNotConfiguredError('Database has not been configured. Call setDb(db) before using getDb().');