DUNGEONS-33: clean shutdown locks and add optional Telegram 2048
Co-authored-by: multica-agent <github@multica.ai>
This commit is contained in:
@@ -5,6 +5,15 @@ import { safeNext, readCookie, clientIp } from '../src/http.js';
|
||||
|
||||
const base = { SESSION_SECRET: 'a-secure-test-secret-longer-than-32-chars' };
|
||||
|
||||
test('Telegram games are optional and use a BotFather short name', () => {
|
||||
assert.equal(loadConfig(base).telegram.gameShortName, '');
|
||||
assert.equal(loadConfig({ ...base, TELEGRAM_GAME_SHORT_NAME: ' ' }).telegram.gameShortName, '');
|
||||
assert.equal(loadConfig({ ...base, TELEGRAM_GAME_SHORT_NAME: ' dungeons_2048 ' }).telegram.gameShortName, 'dungeons_2048');
|
||||
for (const name of ['@gamebot', 'https://t.me/gamebot?game=2048', 'my game', 'a'.repeat(31)]) {
|
||||
assert.throws(() => loadConfig({ ...base, TELEGRAM_GAME_SHORT_NAME: name }), /TELEGRAM_GAME_SHORT_NAME/);
|
||||
}
|
||||
});
|
||||
|
||||
test('configuration rejects unsafe origins, weak secrets, invalid numbers, and incomplete bots', () => {
|
||||
for (const options of [
|
||||
{ SESSION_SECRET: '' }, { SESSION_SECRET: 'replace-with-a-random-secret-at-least-32-characters' },
|
||||
|
||||
Reference in New Issue
Block a user