mirror of
https://wget.la/https://github.com/Wxw-Gu/WechatExplorer
synced 2026-10-10 01:42:49 +08:00
feat: 优化档案搜索与头像
新增退群监控开关 发送限速
This commit is contained in:
@@ -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 />)
|
||||
|
||||
Reference in New Issue
Block a user