feat: read-only roominfo (owner/announcement/openim) on GroupSnapshot

This commit is contained in:
wuyouMaster
2026-09-25 00:06:48 +08:00
parent afb876250e
commit 99c6e923bc
3 changed files with 129 additions and 2 deletions
+31
View File
@@ -0,0 +1,31 @@
import { describe, expect, it } from 'vitest'
import { normalizeRoomInfoRow } from '../../src/main/wcdb4-client'
describe('normalizeRoomInfoRow', () => {
it('maps versioned chatroom column aliases', () => {
expect(
normalizeRoomInfoRow('123@chatroom', {
chatroomname: '123@chatroom',
roomowner: 'wxid_owner',
textannouncement: '群公告',
announcement_editor_: 'wxid_editor',
max_member_count: 500,
chatroomnick: '测试群',
openim_acct_type: '2'
})
).toEqual({
roomId: '123@chatroom',
owner: 'wxid_owner',
announcement: '群公告',
announcementEditor: 'wxid_editor',
maxMemberCount: 500,
chatName: '测试群',
openImAccountType: '2',
isOpenIm: true
})
expect(normalizeRoomInfoRow('9@chatroom', { room_owner: 'wxid_b' })).toMatchObject({
owner: 'wxid_b',
isOpenIm: undefined
})
})
})