Files
WechatExplorer/tests/unit/quoted-messages.test.ts
T
Wxw-Gu c70e49bf16 fix: 完善聊天解析与导出体验
- 修复引用消息名称和图片布局
- 明确单会话图片测试日志范围
- 支持导出文件附件
- 完善图片批测、会话刷新和安全退出
2026-08-04 12:03:07 +08:00

36 lines
1.0 KiB
TypeScript

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: '测试群成员' })
})
})