Personal Telegram developer console for GitHub

test: require commit report drill-down

davoodmehraban89 committed Oct 4, 2026 at 17:41 UTC 30af46c41c2409c892d3c7dd15cd830ba6ba408d
1 file changed +19 -2
test/telegram-menu-e2e.test.js
+19 -2
@@ -3,8 +3,11 @@ import assert from 'node:assert/strict';
3 import { createGitHubPlugin } from '../src/plugins/github/plugin.js';
4
5 const repoId = 123;
6 +const fullSha = '0123456789abcdef0123456789abcdef01234567';
7 const github = {
8 async getRepository() { return { id: repoId, name: 'nexa-dev-bot', fullName: 'davoodmehraban89/nexa-dev-bot', defaultBranch: 'main' }; },
9 + async listCommits() { return [{ sha: fullSha, shortSha: fullSha.slice(0, 7), message: 'Audit commit report', author: 'owner', date: '2026-10-04T12:00:00Z' }]; },
10 + async getCommit() { return { sha: fullSha, shortSha: fullSha.slice(0, 7), message: 'Audit commit report\n\nDetailed commit body', author: 'owner', date: '2026-10-04T12:00:00Z', additions: 12, deletions: 4, changedFiles: 2, files: [{ filename: 'src/menu.js', status: 'modified', additions: 8, deletions: 2 }, { filename: 'test/menu.test.js', status: 'modified', additions: 4, deletions: 2 }] }; },
11 async listIssuesPage() { return { items: [{ number: 7, title: 'Broken report', state: 'open', author: 'owner', comments: 3 }], hasMore: false }; },
12 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' }; },
13 async listReleases() { return [{ id: 9, tag: 'v2.1.0', name: 'V2.1', draft: false, prerelease: false, publishedAt: '2026-10-04T10:00:00Z' }]; },
@@ -19,6 +22,19 @@ function assertTelegramContract(view) {
22 for (const callback of callbacks(view)) assert.ok(Buffer.byteLength(callback, 'utf8') <= 64, callback);
23 }
24
25 +test('commit list drills into source-backed commit detail and preserves recovery navigation', async () => {
26 + const plugin = createGitHubPlugin({ github, menu, workspaces });
27 + const list = await plugin.resolveCallback(`commits:${repoId}`).execute();
28 + assertTelegramContract(list);
29 + assert.ok(callbacks(list).includes(`commitdetail:${repoId}:${fullSha}`), 'commit list must expose detail drill-down');
30 + const detail = await plugin.resolveCallback(`commitdetail:${repoId}:${fullSha}`).execute();
31 + assertTelegramContract(detail);
32 + assert.match(detail.text, /Detailed commit body/);
33 + assert.match(detail.text, /src\/menu\.js/);
34 + assert.match(detail.text, /\+12\/-4/);
35 + assert.ok(callbacks(detail).includes(`commits:${repoId}`));
36 +});
37 +
38 test('issue list drills into actionable issue detail and preserves recovery navigation', async () => {
39 const plugin = createGitHubPlugin({ github, menu, workspaces });
40 const list = await plugin.resolveCallback(`issues:${repoId}`).execute();
@@ -44,13 +60,14 @@ test('release list drills into source-backed release notes and preserves recover
60 test('repository report views always retain a project recovery route', async () => {
61 const emptyGithub = {
62 ...github,
63 + async listCommits() { return []; },
64 async listIssuesPage() { return { items: [], hasMore: false }; },
65 async listReleases() { return []; }
66 };
67 const plugin = createGitHubPlugin({ github: emptyGithub, menu, workspaces });
51 - for (const callback of [`issues:${repoId}`, `releases:${repoId}`]) {
68 + for (const callback of [`commits:${repoId}`, `issues:${repoId}`, `releases:${repoId}`]) {
69 const view = await plugin.resolveCallback(callback).execute();
70 assertTelegramContract(view);
71 assert.ok(callbacks(view).includes(`repo:${repoId}`), `${callback} must retain project recovery`);
72 }
56 -});
73 +});
\ No newline at end of file