Personal Telegram developer console for GitHub
test: require V2.1 guide and production docs
davoodmehraban89 committed
Oct 4, 2026 at 15:33 UTC
7c247813b517d9a0fa185c551ed2ad05b813a668
1 file changed
+27
-10
test/help-guide.test.js
+27
-10
@@ -1,5 +1,6 @@
1
import { describe, it } from 'node:test';
2
import assert from 'node:assert/strict';
3
+import { readFileSync } from 'node:fs';
4
import { GuideMenuManager } from '../src/guide-menu.js';
5
import { GuidedNexaDevBot } from '../src/guide-bot.js';
6
@@ -15,7 +16,7 @@ function callbacks(view) {
16
return (view.reply_markup?.inline_keyboard || []).flat().map(button => button.callback_data).filter(Boolean);
17
}
18
18
-describe('Nexa Dev Bot - in-app V2 guide', () => {
19
+describe('Nexa Dev Bot - in-app V2.1 guide', () => {
20
const menu = new GuideMenuManager(github);
21
22
it('exposes Guide from the main inline menu', () => {
@@ -24,16 +25,16 @@ describe('Nexa Dev Bot - in-app V2 guide', () => {
25
assert.ok(view.reply_markup.inline_keyboard.flat().some(button => button.text.includes('راهنما')));
26
});
27
27
- it('guide index and pages explain every major V2 control with navigable chapters', async () => {
28
+ it('guide index and pages identify V2.1 and expose all seven navigable chapters', async () => {
29
const index = await menu.renderByCallback('menu:help');
29
- assert.match(index.text, /راهنمای Nexa Dev.*V2/);
30
+ assert.match(index.text, /راهنمای Nexa Dev.*V2\.1/);
31
const indexCallbacks = callbacks(index);
31
- for (const callback of ['help:1', 'help:2', 'help:3', 'help:4', 'help:5', 'help:6']) {
32
+ for (const callback of ['help:1', 'help:2', 'help:3', 'help:4', 'help:5', 'help:6', 'help:7']) {
33
assert.ok(indexCallbacks.includes(callback), `missing ${callback}`);
34
}
35
36
const menuHelp = await menu.renderByCallback('help:1');
36
- for (const label of ['منوی اصلی', 'پروژهها', 'وضعیت', 'ابزارها', 'امنیت', 'راهنما']) {
37
+ for (const label of ['منوی اصلی', 'پروژهها', 'وضعیت', 'ابزارها', 'پیکربندی', 'امنیت', 'راهنما']) {
38
assert.ok(menuHelp.text.includes(label), `menu guide missing ${label}`);
39
}
40
@@ -43,7 +44,7 @@ describe('Nexa Dev Bot - in-app V2 guide', () => {
44
}
45
46
const workspaceHelp = await menu.renderByCallback('help:3');
46
- for (const label of ['Edit', 'Editor', 'بارگذاری فایل', 'Paste متن', 'پیام Commit', 'Diff', 'آماده Commit', 'لغو Draft']) {
47
+ for (const label of ['Edit', 'Editor', 'Mini App', 'WORKSPACE_STORE', 'بارگذاری فایل', 'Paste متن', 'پیام Commit', 'Diff', 'آماده Commit', 'لغو Draft']) {
48
assert.ok(workspaceHelp.text.includes(label), `workspace guide missing ${label}`);
49
}
50
@@ -53,14 +54,14 @@ describe('Nexa Dev Bot - in-app V2 guide', () => {
54
}
55
});
56
56
- it('documents the operational diagnostics, read-only configuration and Security Center controls', async () => {
57
+ it('documents operational diagnostics, read-only configuration and Security Center controls', async () => {
58
const menuHelp = await menu.renderByCallback('help:1');
59
for (const label of ['خودآزمایی', 'تست اتصال GitHub', 'Runtime', 'Plugin Registry', 'پیکربندی', 'فقطخواندنی']) {
60
assert.ok(menuHelp.text.includes(label), `operational guide missing ${label}`);
61
}
62
63
const securityHelp = await menu.renderByCallback('help:6');
63
- for (const label of ['مرکز امنیت', 'سیاست عملیات', 'Safe Approval', 'Replay']) {
64
+ for (const label of ['مرکز امنیت', 'سیاست عملیات', 'Safe Approval', 'Replay', 'Owner-only']) {
65
assert.ok(securityHelp.text.includes(label), `security guide missing ${label}`);
66
}
67
});
@@ -85,9 +86,17 @@ describe('Nexa Dev Bot - in-app V2 guide', () => {
86
assert.match(view.text, /main.*مستقیم.*تغییر|شاخه.*پیش.?فرض.*تغییر.*نمی/);
87
});
88
89
+ it('documents production, Cloudflare deployment, preview isolation and the public status boundary', async () => {
90
+ const view = await menu.renderByCallback('help:7');
91
+ for (const label of ['Production', 'Cloudflare', 'Deploy', 'Preview', 'Durable Object', '/status', 'حداقلی', 'Observability']) {
92
+ assert.ok(view.text.includes(label), `production guide missing ${label}`);
93
+ }
94
+ assert.match(view.text, /داخل Telegram.*جزئیات|جزئیات.*داخل Telegram/);
95
+ });
96
+
97
it('keeps every guide page and callback within Telegram limits', async () => {
98
const encoder = new TextEncoder();
90
- for (const callback of ['menu:help', 'help:1', 'help:2', 'help:3', 'help:4', 'help:5', 'help:6']) {
99
+ for (const callback of ['menu:help', 'help:1', 'help:2', 'help:3', 'help:4', 'help:5', 'help:6', 'help:7']) {
100
const view = await menu.renderByCallback(callback);
101
assert.ok(view.text.length <= 4096, `${callback} exceeds Telegram message limit`);
102
for (const value of callbacks(view)) {
@@ -110,6 +119,14 @@ describe('Nexa Dev Bot - in-app V2 guide', () => {
119
120
sent.length = 0;
121
await bot.handleMessage({ chat: { id: 1 }, from: { id: 1 }, text: '📘 راهنما' });
113
- assert.match(sent[0].text, /راهنمای Nexa Dev.*V2/);
122
+ assert.match(sent[0].text, /راهنمای Nexa Dev.*V2\.1/);
123
+ });
124
+
125
+ it('keeps README aligned with the deployed V2.1 architecture', () => {
126
+ const readme = readFileSync(new URL('../README.md', import.meta.url), 'utf8');
127
+ for (const label of ['Workspace Editor', 'WORKSPACE_STORE', 'APPROVAL_REPLAY_GUARD', 'Ops Console', 'پیکربندی', 'Worker Preview', 'Mini App', '/status']) {
128
+ assert.ok(readme.includes(label), `README missing ${label}`);
129
+ }
130
+ assert.doesNotMatch(readme, /ناوبری callback بهصورت stateless/);
131
});
132
});