Personal Telegram developer console for GitHub

test(github): require one actionable PR menu path

davoodmehraban89 committed Oct 4, 2026 at 17:54 UTC d7a7f69738357f401aec946074acbf5ab03f4fa0
1 file changed +12 -2
test/github-advanced-plugin.test.js
+12 -2
@@ -40,7 +40,8 @@ function makeMenu() {
40 async getReposListView() { return { text: 'repos', reply_markup: { inline_keyboard: [] } }; },
41 async renderByCallback(data) {
42 if (String(data).startsWith('repo:')) {
43 - return { text: 'repo', reply_markup: { inline_keyboard: [[{ text: 'back', callback_data: 'menu:repos' }]] } };
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' }]] } };
45 }
46 return { text: `legacy:${data}`, reply_markup: { inline_keyboard: [] } };
47 }
@@ -88,7 +89,8 @@ 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);
91 - for (const expected of ['runs:123', 'branches:123', 'prs:123', 'issues:123', 'releases:123']) assert.ok(repoCallbacks.includes(expected), expected);
92 + for (const expected of ['runs: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
95 const runView = await plugin.resolveCallback('run:123:77').execute();
96 assert.ok(callbacks(runView).includes('artifacts:123:77'));
@@ -100,6 +102,14 @@ test('repository and workflow views expose Advanced READ navigation', async () =
102 assert.ok(callbacks(jobView).includes('joblog:123:88'));
103 });
104
105 +test('legacy repository PR button resolves to the actionable advanced PR report', async () => {
106 + const plugin = createGitHubPlugin({ github: makeGitHub(), menu: makeMenu() });
107 + const route = plugin.resolveCallback('pr:123');
108 + assert.equal(route?.actionId, 'github.pr.advanced.list');
109 + const view = await route.execute();
110 + assert.ok(callbacks(view).includes('prdetail:123:19'), 'repository PR button must drill into PR detail');
111 +});
112 +
113 test('failed job log is escaped and bounded-tail state is visible', async () => {
114 const plugin = createGitHubPlugin({ github: makeGitHub(), menu: makeMenu() });
115 const view = await plugin.resolveCallback('joblog:123:88').execute();