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): 历史桶持续失败时用同一个组件验证角标归零

WZBbiao545d48ab56c8
diff --git a/apps/desktop/src/renderer/__tests__/AppBadgeAttentionSync.test.tsx b/apps/desktop/src/renderer/__tests__/AppBadgeAttentionSync.test.tsx
index 40ed26a906..d9e0dc8298 100644
--- a/apps/desktop/src/renderer/__tests__/AppBadgeAttentionSync.test.tsx
+++ b/apps/desktop/src/renderer/__tests__/AppBadgeAttentionSync.test.tsx
@@ -194,14 +194,13 @@ describe('app badge projection lifecycle', () => {
// 否则角标会永久停在最后一次推送的旧值(界面上已经没有未读了)。
state.historyLoading = true;
state.historyError = new Error('db busy');
- render(<AppBadgeAttentionSync />);
+ const view = render(<AppBadgeAttentionSync />);
expect(state.publish).toHaveBeenLastCalledWith(
expect.objectContaining({ count: 3, sessionIds: ['a', 'b', 'c'] }),
);
- state.historyLoading = false;
- state.historyError = null;
+ // 历史桶一直坏着,同一个组件在未读清零后也必须把 0 推下去。
state.attention = new Map();
- render(<AppBadgeAttentionSync />);
+ view.rerender(<AppBadgeAttentionSync />);
expect(state.publish).toHaveBeenLastCalledWith(expect.objectContaining({ count: 0 }));
});