mirror of
https://wget.la/https://github.com/Wxw-Gu/WechatExplorer
synced 2026-08-18 12:07:01 +08:00
feat: 完善聊天导出与档案浏览
1. 修复数据量较大时,历史数据可能无法完整导出的问题 2. 优化分享 Tab 的信息展示,支持小程序、链接、地图等消息 3. 优化系统 Tab 的信息展示,支持红包、转账、拍一拍、撤回等消息 4. 修复默认进入时,时间轴不随消息自动定位的问题 5. 增加“定位到聊天位置”功能
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
import { describe, expect, it, vi } from 'vitest'
|
||||
import { Wcdb4Client, type Wcdb4Message } from '../../src/main/wcdb4-client'
|
||||
|
||||
const message = (id: string, year: number): Wcdb4Message => ({
|
||||
const message = (id: string, year: number, serverId = `server-${id}`): Wcdb4Message => ({
|
||||
mesLocalID: id,
|
||||
serverId: `server-${id}`,
|
||||
serverId,
|
||||
mesDes: 0,
|
||||
messageType: '1',
|
||||
msgCreateTime: String(Math.floor(Date.UTC(year, 0, 1) / 1000)),
|
||||
@@ -12,6 +12,21 @@ const message = (id: string, year: number): Wcdb4Message => ({
|
||||
})
|
||||
|
||||
describe('WCDB message shard pagination', () => {
|
||||
it('keeps messages whose local ids repeat across database shards', async () => {
|
||||
const cursor = vi.fn(async () => [
|
||||
message('1', 2024, 'server-2024'),
|
||||
message('1', 2025, 'server-2025')
|
||||
])
|
||||
const client = Object.assign(Object.create(Wcdb4Client.prototype), {
|
||||
getMessagesByCursorAsync: cursor
|
||||
}) as Wcdb4Client
|
||||
|
||||
const result = await client.getMessagesAsync('fixture@chatroom')
|
||||
|
||||
expect(result).toHaveLength(2)
|
||||
expect(result.map((item) => item.serverId)).toEqual(['server-2024', 'server-2025'])
|
||||
})
|
||||
|
||||
it('merges cursor and all-store rows for a bounded cross-year page', async () => {
|
||||
const cursor = vi.fn(async () => [message('2025', 2025)])
|
||||
const tableScan = vi.fn(async () => [message('2017', 2017), message('2025', 2025)])
|
||||
|
||||
Reference in New Issue
Block a user