Personal Telegram developer console for GitHub

test: enforce Telegram guide transport limits

davoodmehraban89 committed Oct 4, 2026 at 12:35 UTC 90f3d2df211a1e076708c42ceed5b116e7dbfdac
1 file changed +11
test/help-guide.test.js
+11
@@ -73,6 +73,17 @@ describe('Nexa Dev Bot - in-app V2 guide', () => {
73 assert.match(view.text, /main.*مستقیم.*تغییر|شاخه.*پیش.?فرض.*تغییر.*نمی/);
74 });
75
76 + it('keeps every guide page and callback within Telegram limits', async () => {
77 + const encoder = new TextEncoder();
78 + for (const callback of ['menu:help', 'help:1', 'help:2', 'help:3', 'help:4', 'help:5', 'help:6']) {
79 + const view = await menu.renderByCallback(callback);
80 + assert.ok(view.text.length <= 4096, `${callback} exceeds Telegram message limit`);
81 + for (const value of callbacks(view)) {
82 + assert.ok(encoder.encode(value).length <= 64, `${value} exceeds Telegram callback limit`);
83 + }
84 + }
85 + });
86 +
87 it('keeps Guide in the persistent bottom keyboard and routes its text without consuming workspace input', async () => {
88 const bot = new GuidedNexaDevBot({});
89 const sent = [];