Personal Telegram developer console for GitHub

test: expose weak Telegram repository reports

davoodmehraban89 committed Oct 4, 2026 at 17:13 UTC 93c32b7d698af95cabefe2b2ec91b3fe3817c6a0
1 file changed +42
test/telegram-menu-e2e.test.js new
+42
@@ -0,0 +1,42 @@
1 +import test from 'node:test';
2 +import assert from 'node:assert/strict';
3 +import { createGitHubPlugin } from '../src/plugins/github/plugin.js';
4 +
5 +const repoId = 123;
6 +const github = {
7 + async getRepository() { return { id: repoId, name: 'nexa-dev-bot', fullName: 'davoodmehraban89/nexa-dev-bot', defaultBranch: 'main' }; },
8 + async listIssuesPage() { return { items: [{ number: 7, title: 'Broken report', state: 'open', author: 'owner', comments: 3 }], hasMore: false }; },
9 + async getIssue() { return { number: 7, title: 'Broken report', state: 'open', author: 'owner', comments: 3, body: 'Reproduction and expected result', labels: ['bug'], assignees: ['owner'], createdAt: '2026-10-04T10:00:00Z', updatedAt: '2026-10-04T11:00:00Z' }; },
10 + async listReleases() { return [{ id: 9, tag: 'v2.1.0', name: 'V2.1', draft: false, prerelease: false, publishedAt: '2026-10-04T10:00:00Z' }]; },
11 + async getRelease() { return { id: 9, tag: 'v2.1.0', name: 'V2.1', body: 'Production release notes', draft: false, prerelease: false, publishedAt: '2026-10-04T10:00:00Z', author: 'owner', target: 'main' }; }
12 +};
13 +const menu = { async renderByCallback() { return { text: 'fallback', reply_markup: { inline_keyboard: [] } }; } };
14 +const workspaces = { async getWorkspace() { return null; } };
15 +
16 +function callbacks(view) { return view.reply_markup.inline_keyboard.flat().map(button => button.callback_data).filter(Boolean); }
17 +function assertTelegramContract(view) {
18 + assert.ok(view.text && view.text.length <= 4096);
19 + for (const callback of callbacks(view)) assert.ok(Buffer.byteLength(callback, 'utf8') <= 64, callback);
20 +}
21 +
22 +test('issue list drills into actionable issue detail and preserves recovery navigation', async () => {
23 + const plugin = createGitHubPlugin({ github, menu, workspaces });
24 + const list = await plugin.resolveCallback(`issues:${repoId}`).execute();
25 + assertTelegramContract(list);
26 + assert.ok(callbacks(list).includes(`issuedetail:${repoId}:7`), 'issue list must expose detail drill-down');
27 + const detail = await plugin.resolveCallback(`issuedetail:${repoId}:7`).execute();
28 + assertTelegramContract(detail);
29 + assert.match(detail.text, /Reproduction and expected result/);
30 + assert.ok(callbacks(detail).includes(`issues:${repoId}`));
31 +}
32 +
33 +test('release list drills into source-backed release notes and preserves recovery navigation', async () => {
34 + const plugin = createGitHubPlugin({ github, menu, workspaces });
35 + const list = await plugin.resolveCallback(`releases:${repoId}`).execute();
36 + assertTelegramContract(list);
37 + assert.ok(callbacks(list).includes(`releasedetail:${repoId}:9`), 'release list must expose detail drill-down');
38 + const detail = await plugin.resolveCallback(`releasedetail:${repoId}:9`).execute();
39 + assertTelegramContract(detail);
40 + assert.match(detail.text, /Production release notes/);
41 + assert.ok(callbacks(detail).includes(`releases:${repoId}`));
42 +}