Personal Telegram developer console for GitHub
test: close Advanced read pagination gaps
davoodmehraban89 committed
Oct 3, 2026 at 09:25 UTC
cd4f9d6e99a647ada172add82b8f5d9699a91bae
1 file changed
+32
test/github-advanced-plugin.test.js
+32
@@ -123,3 +123,35 @@ test('branches, PRs, issues and releases provide useful drill-down and paginatio
123
const releases = await plugin.resolveCallback('releases:123').execute();
124
assert.match(releases.text, /v1\.2\.0/);
125
});
126
+
127
+test('artifacts support bounded page navigation instead of silently stopping at the first page', async () => {
128
+ const calls = [];
129
+ const github = makeGitHub();
130
+ github.listWorkflowArtifacts = async (repoId, runId, options) => {
131
+ calls.push({ repoId, runId, options });
132
+ return Array.from({ length: 10 }, (_, i) => ({ id: i + 1, name: `artifact-${i + 1}`, size: 1, expired: false }));
133
+ };
134
+ const plugin = createGitHubPlugin({ github, menu: makeMenu() });
135
+ const route = plugin.resolveCallback('artifacts:123:77:2');
136
+ assert.equal(route?.actionId, 'github.workflow.artifacts.list');
137
+ const view = await route.execute();
138
+ assert.deepEqual(calls[0], { repoId: 123, runId: 77, options: { perPage: 10, page: 2 } });
139
+ assert.ok(callbacks(view).includes('artifacts:123:77:1'));
140
+ assert.ok(callbacks(view).includes('artifacts:123:77:3'));
141
+});
142
+
143
+test('PR diff pages request only the number of files they can render and expose the next page', async () => {
144
+ const calls = [];
145
+ const github = makeGitHub();
146
+ github.listPullRequestFiles = async (repoId, prNumber, options) => {
147
+ calls.push({ repoId, prNumber, options });
148
+ return Array.from({ length: 8 }, (_, i) => ({
149
+ filename: `src/file-${i + 1}.js`, status: 'modified', additions: 1, deletions: 0, changes: 1, patch: '+x'
150
+ }));
151
+ };
152
+ const plugin = createGitHubPlugin({ github, menu: makeMenu() });
153
+ const view = await plugin.resolveCallback('prfiles:123:19:1').execute();
154
+ assert.deepEqual(calls[0], { repoId: 123, prNumber: 19, options: { perPage: 8, page: 1 } });
155
+ assert.match(view.text, /file-8\.js/);
156
+ assert.ok(callbacks(view).includes('prfiles:123:19:2'));
157
+});