Files
Wxw-Gu 47e0d7cd1e fix: 更新打包配置并修复群昵称刷新
更新跨平台 WCDB 和运行时命名。
优化消息获取速度
修复群昵称刷新回退与消息发送者显示,并增加可控的消息读取诊断日志和有界查询优化。
2026-08-25 14:26:29 +08:00

33 lines
1007 B
TypeScript

import { afterEach, describe, expect, it, vi } from 'vitest'
import { isWcdbDebugEnabled, wcdbDebugLog } from '../../src/main/wcdb-debug'
const originalDebugValue = process.env.WCDB_DEBUG_LOGS
afterEach(() => {
if (originalDebugValue === undefined) delete process.env.WCDB_DEBUG_LOGS
else process.env.WCDB_DEBUG_LOGS = originalDebugValue
vi.restoreAllMocks()
})
describe('WCDB debug logging', () => {
it('is disabled by default', () => {
delete process.env.WCDB_DEBUG_LOGS
const log = vi.spyOn(console, 'log').mockImplementation(() => {})
wcdbDebugLog('[GETMSG-001] hidden')
expect(isWcdbDebugEnabled()).toBe(false)
expect(log).not.toHaveBeenCalled()
})
it('logs when WCDB_DEBUG_LOGS is enabled', () => {
process.env.WCDB_DEBUG_LOGS = '1'
const log = vi.spyOn(console, 'log').mockImplementation(() => {})
wcdbDebugLog('[GETMSG-001] visible')
expect(isWcdbDebugEnabled()).toBe(true)
expect(log).toHaveBeenCalledWith('[GETMSG-001] visible')
})
})