@spaceflow/core 0.16.0 → 0.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -383,11 +383,11 @@ describe("GiteaAdapter", () => {
|
|
|
383
383
|
});
|
|
384
384
|
|
|
385
385
|
describe("listPullReviews", () => {
|
|
386
|
-
it("应请求正确的 URL", async () => {
|
|
386
|
+
it("应请求正确的 URL(带分页参数)", async () => {
|
|
387
387
|
fetchSpy.mockResolvedValue(mockResponse([]));
|
|
388
388
|
await adapter.listPullReviews("owner", "repo", 42);
|
|
389
389
|
expect(fetchSpy).toHaveBeenCalledWith(
|
|
390
|
-
"https://gitea.example.com/api/v1/repos/owner/repo/pulls/42/reviews",
|
|
390
|
+
"https://gitea.example.com/api/v1/repos/owner/repo/pulls/42/reviews?page=1&limit=50",
|
|
391
391
|
expect.anything(),
|
|
392
392
|
);
|
|
393
393
|
});
|
|
@@ -438,7 +438,20 @@ export class GiteaAdapter implements GitProvider {
|
|
|
438
438
|
}
|
|
439
439
|
|
|
440
440
|
async listPullReviews(owner: string, repo: string, index: number): Promise<PullReview[]> {
|
|
441
|
-
|
|
441
|
+
const allReviews: PullReview[] = [];
|
|
442
|
+
let page = 1;
|
|
443
|
+
const limit = 50;
|
|
444
|
+
while (true) {
|
|
445
|
+
const reviews = await this.request<PullReview[]>(
|
|
446
|
+
"GET",
|
|
447
|
+
`/repos/${owner}/${repo}/pulls/${index}/reviews?page=${page}&limit=${limit}`,
|
|
448
|
+
);
|
|
449
|
+
if (!reviews || reviews.length === 0) break;
|
|
450
|
+
allReviews.push(...reviews);
|
|
451
|
+
if (reviews.length < limit) break;
|
|
452
|
+
page++;
|
|
453
|
+
}
|
|
454
|
+
return allReviews;
|
|
442
455
|
}
|
|
443
456
|
|
|
444
457
|
async updatePullReview(
|