Personal Telegram developer console for GitHub

test(github): require one actionable status menu path

davoodmehraban89 committed Oct 4, 2026 at 17:59 UTC d146e6c3ca3a37a419e730697495f543a930d659
1 file changed +12 -3
test/github-advanced-plugin.test.js
+12 -3
@@ -15,7 +15,7 @@ function makeGitHub() {
15 return {
16 calls,
17 async getRepository(id) { return hit('getRepository', { id: String(id), name: 'nexa-dev-bot', defaultBranch: 'main' }); },
18 - async listWorkflowRuns() { return []; },
18 + async listWorkflowRuns() { return [{ id: 77, name: 'CI', status: 'completed', conclusion: 'success', branch: 'main', sha: 'abc1234', runNumber: 44 }]; },
19 async getWorkflowRun(repo, run) { return hit('getWorkflowRun', { id: run, name: 'CI', status: 'completed', conclusion: 'failure', runNumber: 134, branch: 'main', sha: 'abc1234', event: 'push' }); },
20 async listWorkflowJobs() { return hit('listWorkflowJobs', [{ id: 88, name: 'test', status: 'completed', conclusion: 'failure', steps: [{ number: 1, name: 'Run tests', conclusion: 'failure' }] }]); },
21 async getWorkflowJob() { return hit('getWorkflowJob', { id: 88, name: 'test', status: 'completed', conclusion: 'failure', steps: [{ number: 1, name: 'Run tests', conclusion: 'failure' }] }); },
@@ -41,7 +41,7 @@ function makeMenu() {
41 async renderByCallback(data) {
42 if (String(data).startsWith('repo:')) {
43 const repoId = String(data).split(':')[1];
44 - return { text: 'repo', reply_markup: { inline_keyboard: [[{ text: 'PRها', callback_data: `pr:${repoId}` }], [{ text: 'back', callback_data: 'menu:repos' }]] } };
44 + return { text: 'repo', reply_markup: { inline_keyboard: [[{ text: 'PRها', callback_data: `pr:${repoId}` }, { text: 'وضعیت', callback_data: `status:${repoId}` }], [{ text: 'back', callback_data: 'menu:repos' }]] } };
45 }
46 return { text: `legacy:${data}`, reply_markup: { inline_keyboard: [] } };
47 }
@@ -89,8 +89,9 @@ test('repository and workflow views expose Advanced READ navigation', async () =
89 const plugin = createGitHubPlugin({ github, menu: makeMenu() });
90 const repoView = await plugin.resolveCallback('repo:123').execute();
91 const repoCallbacks = callbacks(repoView);
92 - for (const expected of ['runs:123', 'branches:123', 'pr:123', 'issues:123', 'releases:123']) assert.ok(repoCallbacks.includes(expected), expected);
92 + for (const expected of ['status:123', 'branches:123', 'pr:123', 'issues:123', 'releases:123']) assert.ok(repoCallbacks.includes(expected), expected);
93 assert.ok(!repoCallbacks.includes('prs:123'), 'repository view must not expose a duplicate advanced PR entry');
94 + assert.ok(!repoCallbacks.includes('runs:123'), 'repository view must not expose a duplicate CI entry');
95
96 const runView = await plugin.resolveCallback('run:123:77').execute();
97 assert.ok(callbacks(runView).includes('artifacts:123:77'));
@@ -102,6 +103,14 @@ test('repository and workflow views expose Advanced READ navigation', async () =
103 assert.ok(callbacks(jobView).includes('joblog:123:88'));
104 });
105
106 +test('legacy repository status button resolves to actionable workflow runs', async () => {
107 + const plugin = createGitHubPlugin({ github: makeGitHub(), menu: makeMenu() });
108 + const route = plugin.resolveCallback('status:123');
109 + assert.equal(route?.actionId, 'github.workflow.runs.list');
110 + const view = await route.execute();
111 + assert.ok(callbacks(view).includes('run:123:77'), 'repository status button must drill into workflow run detail');
112 +});
113 +
114 test('legacy repository PR button resolves to the actionable advanced PR report', async () => {
115 const plugin = createGitHubPlugin({ github: makeGitHub(), menu: makeMenu() });
116 const route = plugin.resolveCallback('pr:123');