Skip to content

armgit / cindy

Public Imported from GitHub
0

Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。

test(group-chat): align lifecycle snapshots and reconnect timing

zqchris009dc912dbad
diff --git a/apps/desktop/src/main/maker-ipc/__tests__/chatServerGroupOpen.test.ts b/apps/desktop/src/main/maker-ipc/__tests__/chatServerGroupOpen.test.ts
index 9d29a3f3a6..6694cd586c 100644
--- a/apps/desktop/src/main/maker-ipc/__tests__/chatServerGroupOpen.test.ts
+++ b/apps/desktop/src/main/maker-ipc/__tests__/chatServerGroupOpen.test.ts
@@ -165,6 +165,7 @@ describe('Chat Server group open latency (simulated 100ms per request)', () => {
fixture.sockets[0].emit('message', JSON.stringify({ type: 'ready' }));
expect(sent()).toContainEqual({ type: 'subscribe', scope: `conversation:${rooms[0]}`, after: '58' });
// A reconnect still re-reads every followed room once.
+ await vi.advanceTimersByTimeAsync(0);
expect(onChanged).toHaveBeenCalledWith({ groupId: rooms[0], change: 'messages' }, undefined);
});
diff --git a/apps/desktop/src/main/maker-ipc/__tests__/chatServerInvitations.test.ts b/apps/desktop/src/main/maker-ipc/__tests__/chatServerInvitations.test.ts
index 00ca0d28f1..b8658ece73 100644
--- a/apps/desktop/src/main/maker-ipc/__tests__/chatServerInvitations.test.ts
+++ b/apps/desktop/src/main/maker-ipc/__tests__/chatServerInvitations.test.ts
@@ -59,7 +59,7 @@ describe('Chat Server invitation contract', () => {
members = [{ id: selfId, ownerActorId: selfId, state: 'joined', role: 'owner' }];
fixture.handle.mockImplementation(route => {
if (route === '/me') return { body: { actor: { id: selfId } } };
- if (route.endsWith('/snapshot')) return { body: { members } };
+ if (route.endsWith('/snapshot')) return { body: { room: { id: groupId, dissolved_at: null }, members, cursor: '0' } };
if (route === `/conversations/${groupId}/invite-links`) return { body: { token, expiresAt, ...(reusable !== undefined ? { reusable } : {}) } };
if (route === '/invite-links/preview') return { body: { groupId, name: 'Group', inviterName: 'Host', expiresAt, ...(reusable !== undefined ? { reusable } : {}), joined: false } };
if (route.endsWith('/invite-links/revoke')) return { body: { revoked: true } };