mirror of
https://wget.la/https://github.com/Wxw-Gu/WechatExplorer
synced 2026-08-17 19:47:08 +08:00
fix: 完善聊天解析与导出体验
- 修复引用消息名称和图片布局 - 明确单会话图片测试日志范围 - 支持导出文件附件 - 完善图片批测、会话刷新和安全退出
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
import { describe, expect, it } from 'vitest'
|
||||
import type { Message } from '../../src/shared/types'
|
||||
import { enrichQuotedMessages } from '../../src/renderer/src/utils/quoted-messages'
|
||||
|
||||
const message = (overrides: Partial<Message>): Message => ({
|
||||
id: 'fixture',
|
||||
from: 'user',
|
||||
type: '普通文本',
|
||||
datetime: '2026-08-04 12:00:00',
|
||||
content: '',
|
||||
isSender: false,
|
||||
createTime: 1_785_816_000,
|
||||
...overrides
|
||||
})
|
||||
|
||||
describe('quoted message enrichment', () => {
|
||||
it('maps an internal quoted sender id to the loaded group member name', () => {
|
||||
const quoted = message({
|
||||
id: 'quote',
|
||||
contentData: {
|
||||
type: 'quote',
|
||||
content: '回复',
|
||||
quotedContent: '[图片]',
|
||||
quotedSender: 'wxid_fixture_member',
|
||||
quotedImageMd5: 'a'.repeat(32)
|
||||
}
|
||||
})
|
||||
|
||||
const [result] = enrichQuotedMessages([quoted], [quoted], (senderId) =>
|
||||
senderId === 'wxid_fixture_member' ? '测试群成员' : undefined
|
||||
)
|
||||
|
||||
expect(result.contentData).toMatchObject({ quotedSender: '测试群成员' })
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user