feat(federation): add POST /api/federation/peers/:id/reset
Admin-only endpoint for recovering from needs_attention. Deletes the local peer row; FK cascade removes queued outbox entries. Gated to peers in needs_attention to prevent accidental resets of healthy peerings (use /peers/:id for revoke on active peers). Also extends the Task 8.5 test mock of '../db/index.js' to re-export `schema`. federation.ts imports `schema` from the re-export alongside `getDb`; the previous mock only exposed `getDb`, causing the route handler to blow up with 500s before reaching any assertion. This is a scaffolding fix — no test assertions were changed.
This commit is contained in:
@@ -16,8 +16,10 @@ let currentUserId = 'admin-user';
|
||||
let currentUserIsAdmin = true;
|
||||
|
||||
// Mock getDb BEFORE importing the route module so the module reads our test DB.
|
||||
// Must also re-export `schema` because federation.ts imports it from '../db/index.js'.
|
||||
vi.mock('../db/index.js', () => ({
|
||||
getDb: () => testDb,
|
||||
schema,
|
||||
}));
|
||||
|
||||
// Mock the auth middleware to honour test-controlled currentUserId / currentUserIsAdmin.
|
||||
|
||||
Reference in New Issue
Block a user