mirror of
https://wget.la/https://github.com/Wxw-Gu/WechatExplorer
synced 2026-08-17 11:37:06 +08:00
fix: 完善聊天解析与导出体验
- 修复引用消息名称和图片布局 - 明确单会话图片测试日志范围 - 支持导出文件附件 - 完善图片批测、会话刷新和安全退出
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
import { mkdirSync, mkdtempSync, realpathSync, rmSync, writeFileSync } from 'fs'
|
||||
import { join } from 'path'
|
||||
import { tmpdir } from 'os'
|
||||
import { afterEach, describe, expect, it } from 'vitest'
|
||||
import { FileAssetService } from '../../src/main/file-asset-service'
|
||||
|
||||
const roots: string[] = []
|
||||
|
||||
afterEach(() => {
|
||||
for (const root of roots.splice(0)) rmSync(root, { recursive: true, force: true })
|
||||
})
|
||||
|
||||
describe('file asset service', () => {
|
||||
it('prefers the message month and supports duplicate download suffixes', () => {
|
||||
const accountRoot = mkdtempSync(join(tmpdir(), 'wxe-file-asset-'))
|
||||
roots.push(accountRoot)
|
||||
const august = join(accountRoot, 'msg', 'file', '2026-08')
|
||||
const july = join(accountRoot, 'msg', 'file', '2026-07')
|
||||
mkdirSync(august, { recursive: true })
|
||||
mkdirSync(july, { recursive: true })
|
||||
writeFileSync(join(july, '产品说明.txt'), 'old')
|
||||
writeFileSync(join(august, '产品说明(1).txt'), 'current')
|
||||
|
||||
const service = new FileAssetService({ getAccountRoot: () => accountRoot })
|
||||
const result = service.resolve('产品说明.txt', new Date(2026, 7, 4).getTime() / 1000)
|
||||
|
||||
expect(result).toMatchObject({ success: true, fileName: '产品说明(1).txt' })
|
||||
expect(result.filePath).toBe(realpathSync(join(august, '产品说明(1).txt')))
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user