mirror of
https://github.com/hansjone/dsh-im-ops.git
synced 2026-10-13 09:03:13 +08:00
Add WeCom QR bot channel
This commit is contained in:
parent
601271a7f8
commit
4874d3e354
33 changed files with 5200 additions and 440 deletions
26
test/channels/wecom/client-api.test.mjs
Normal file
26
test/channels/wecom/client-api.test.mjs
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
import assert from 'node:assert/strict';
|
||||
import test from 'node:test';
|
||||
|
||||
import {
|
||||
normalizeProvisioning,
|
||||
normalizeSnapshot,
|
||||
safeQrSource,
|
||||
} from '../../../plugin-src/client/channels/wecom/api.js';
|
||||
|
||||
test('Enterprise WeChat client keeps only redacted bot and Host-rendered QR state', () => {
|
||||
const qr = 'data:image/png;base64,YWJjZA==';
|
||||
assert.equal(safeQrSource(qr), qr);
|
||||
const provision = normalizeProvisioning({
|
||||
attemptId: 'attempt_1', status: 'pending', expiresAt: Date.now() + 1_000, qrCodeDataUrl: qr,
|
||||
});
|
||||
assert.equal(provision.qrCodeDataUrl, qr);
|
||||
const snapshot = normalizeSnapshot({
|
||||
bots: [{
|
||||
botId: 'wecom_abc', connected: true, state: 'connected',
|
||||
bot: { name: '企业微信机器人', appIdMasked: 'bot••••001' },
|
||||
health: { summary: '运行正常' },
|
||||
}],
|
||||
});
|
||||
assert.equal(snapshot.totals.connected, 1);
|
||||
assert.equal(snapshot.bots[0].bot.appIdMasked, 'bot••••001');
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue