feat: 优化档案搜索与头像

新增退群监控开关
发送限速
This commit is contained in:
Wxw-Gu
2026-09-03 18:12:29 +08:00
parent 3462d49516
commit 719ffa0a24
33 changed files with 1025 additions and 64 deletions
@@ -41,6 +41,7 @@ const state: GroupExitMonitorState = {
detectedAt: 1_756_600_100_000
}
],
enabled: true,
running: true,
nativeMonitorActive: true,
monitoredGroupCount: 3,
@@ -93,6 +94,28 @@ describe('GroupExitMonitorWorkspace', () => {
expect(screen.getByText('实时监听已启用')).toBeVisible()
})
it('persists the master switch and shows the paused state', async () => {
const user = userEvent.setup()
const pausedState = { ...state, enabled: false, running: false }
const setEnabled = vi.fn().mockResolvedValue(pausedState)
window.api = {
getGroupExitMonitorState: vi.fn().mockResolvedValue(state),
onGroupExitMonitorState: vi.fn(() => () => undefined),
setGroupExitMonitorEnabled: setEnabled,
checkGroupExitMonitorNow: vi.fn().mockResolvedValue(state),
clearGroupExitMonitorEvents: vi.fn().mockResolvedValue(state)
} as typeof window.api
renderWorkspace(<GroupExitMonitorWorkspace dbReady />)
const masterSwitch = await screen.findByRole('switch', { name: '退群监控总开关' })
expect(masterSwitch).toBeChecked()
await user.click(masterSwitch)
await waitFor(() => expect(setEnabled).toHaveBeenCalledWith(false))
expect(screen.getByText('监控已暂停')).toBeVisible()
expect(screen.getByRole('button', { name: '立即检查' })).toBeDisabled()
})
it('filters to groups that have exit events and clears the history', async () => {
const user = userEvent.setup()
renderWorkspace(<GroupExitMonitorWorkspace dbReady />)