test(wecom): add synthetic tests for enterprise message support

This commit is contained in:
TraceMemo Custom Build committed 2026-11-23 11:21:18 +08:00
1 parent eac16ad8a7
commit 8f37ded71e
6 files changed
+269

No files matched your search

+19
View File
@@ -0,0 +1,19 @@
import { describe, expect, it } from 'vitest'
import { parseMessageContent } from '../../src/main/message-parser'
/** Synthetic payloads only — no real content, keys, or identifiers. */
describe(`enterprise image content parsing`, () => {
it(`recognizes an aeskey-only enterprise image`, () => {
const xml = `<img aeskey="fixtureaeskey0000000000000000000" encryver="0" cdnmidimgurl="fixture-url"/>`
const parsed = parseMessageContent(xml, 3)
expect(parsed.type).toBe(`image`)
if (parsed.type === `image`) {
expect(parsed.md5).toBeUndefined()
expect(parsed.aeskey).toBe(`fixtureaeskey0000000000000000000`)
}
})
it(`still rejects img content with no identity fields`, () => {
expect(parseMessageContent('<img/>', 3).type).toBe('unknown')
})
})