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(desktop): 从首读开始验证不自动重试

zcinta0514111a70ee84db
diff --git a/apps/desktop/src/renderer/features/bots/__tests__/BotGroupChatView.test.tsx b/apps/desktop/src/renderer/features/bots/__tests__/BotGroupChatView.test.tsx
index 77123309d5..a7118a6514 100644
--- a/apps/desktop/src/renderer/features/bots/__tests__/BotGroupChatView.test.tsx
+++ b/apps/desktop/src/renderer/features/bots/__tests__/BotGroupChatView.test.tsx
@@ -1447,16 +1447,16 @@ describe('BotGroupChatView', () => {
it('keeps the header with a retry when the first read fails', async () => {
await listGroups([detail()]);
mocks.getBotGroup.mockResolvedValueOnce({ ok: false, errorCode: 'REQUEST_TIMEOUT', message: '' });
- renderView();
- expect(await screen.findByText('bots.groupChat.loadFailedTitle')).toBeTruthy();
- expect(screen.getByTestId('content-header').textContent).toContain('周末出游');
vi.useFakeTimers();
try {
+ await act(async () => { renderView(); });
+ expect(screen.getByText('bots.groupChat.loadFailedTitle')).toBeTruthy();
+ expect(screen.getByTestId('content-header').textContent).toContain('周末出游');
await act(async () => { await vi.advanceTimersByTimeAsync(60_000); });
expect(mocks.getBotGroup).toHaveBeenCalledTimes(1);
- } finally { vi.useRealTimers(); }
- fireEvent.click(screen.getByRole('button', { name: /bots.retry/ }));
- expect(await screen.findByText('周六 8:10 有票')).toBeTruthy();
+ await act(async () => { fireEvent.click(screen.getByRole('button', { name: /bots.retry/ })); });
+ expect(screen.getByText('周六 8:10 有票')).toBeTruthy();
+ } finally { cleanup(); vi.useRealTimers(); }
});
it('shows no header for a group that is no longer listed, then the unavailable state', async () => {