Personal Telegram developer console for GitHub

test: reject duplicate weak PR navigation

davoodmehraban89 committed Oct 4, 2026 at 17:51 UTC cd85dee4a95d6cfb18b2b26d2c7fc8c51f1af808
1 file changed +4 -2
test/github-advanced-plugin.test.js
+4 -2
@@ -40,7 +40,7 @@ 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 + return { text: 'repo', reply_markup: { inline_keyboard: [[{ text: 'PR', callback_data: 'pr:123' }], [{ text: 'back', callback_data: 'menu:repos' }]] } };
44 }
45 return { text: `legacy:${data}`, reply_markup: { inline_keyboard: [] } };
46 }
@@ -66,6 +66,7 @@ test('advanced callbacks resolve without provider side effects and callbacks sta
66 ['artifacts:123:77', 'github.workflow.artifacts.list'],
67 ['branches:123', 'github.branches.list'],
68 [`compare:123:${sha}`, 'github.compare.read'],
69 + ['pr:123', 'github.pr.advanced.list'],
70 ['prs:123', 'github.pr.advanced.list'],
71 ['prdetail:123:19', 'github.pr.detail'],
72 ['prfiles:123:19:1', 'github.pr.files.list'],
@@ -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', 'issues:123', 'releases:123']) assert.ok(repoCallbacks.includes(expected), expected);
93 + assert.deepEqual(repoCallbacks.filter(value => value === 'pr:123' || value === 'prs:123'), ['pr:123'], 'repository view must expose one useful PR entry');
94
95 const runView = await plugin.resolveCallback('run:123:77').execute();
96 assert.ok(callbacks(runView).includes('artifacts:123:77'));