mirror of
https://github.com/hansjone/dsh-im-ops.git
synced 2026-10-16 21:10:47 +08:00
feat: secure Telegram access and connect AI Office
This commit is contained in:
parent
e3ae772106
commit
b0606159e0
30 changed files with 2045 additions and 302 deletions
20
test/channels/telegram/production.test.mjs
Normal file
20
test/channels/telegram/production.test.mjs
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
import assert from 'node:assert/strict';
|
||||
import test from 'node:test';
|
||||
|
||||
import { normalizeTelegramAllowedUsers } from '../../../plugin-src/host/channels/telegram/production.mjs';
|
||||
|
||||
test('Telegram production normalizes and validates private-message allowlists', () => {
|
||||
assert.deepEqual(normalizeTelegramAllowedUsers(undefined), []);
|
||||
assert.deepEqual(
|
||||
normalizeTelegramAllowedUsers([6087707998, '1202499116', '6087707998']),
|
||||
['6087707998', '1202499116'],
|
||||
);
|
||||
assert.throws(
|
||||
() => normalizeTelegramAllowedUsers('6087707998'),
|
||||
/must be an array/,
|
||||
);
|
||||
assert.throws(
|
||||
() => normalizeTelegramAllowedUsers([0, '-100123', 'username']),
|
||||
/invalid Telegram User ID/,
|
||||
);
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue