fix: asegurar grupo existente en DB; actualizar prueba de gating

Co-authored-by: aider (openrouter/openai/gpt-5) <aider@aider.chat>
pull/1/head
borja 1 month ago
parent d747e7aa4b
commit 37db7b283d

@ -811,6 +811,8 @@ export class GroupSyncService {
} catch {}
try {
// Asegurar existencia del grupo en DB (FKs) antes de reconciliar
this.ensureGroupExists(groupId);
const snapshot = await (this as any).fetchGroupMembersFromAPI(groupId);
return this.reconcileGroupMembers(groupId, snapshot);
} catch (e) {

@ -79,9 +79,9 @@ describe('WebhookServer - enforce gating (modo=enforce)', () => {
// No debe haber respuestas encoladas (retorno temprano)
expect(SimulatedResponseQueue.get().length).toBe(0);
// allowed_groups no contiene allowed para ese grupo
// allowed_groups no contiene allowed para ese grupo (get() devuelve null cuando no hay filas)
const row = testDb.query(`SELECT status FROM allowed_groups WHERE group_id = 'blocked-group@g.us'`).get() as any;
expect(row).toBeUndefined();
expect(row == null).toBe(true);
});
test('permite mensaje en grupo allowed y procesa comando', async () => {

Loading…
Cancel
Save