feat: 补齐 Gitea PR 来源摘要
This commit is contained in:
@@ -21,6 +21,15 @@ describe('ProjectsService', () => {
|
||||
branches?: Array<{ name: string; commitSha: string }>;
|
||||
tags?: Array<{ name: string; commitSha: string }>;
|
||||
commits?: Record<string, { sha: string; message: string }>;
|
||||
pullRequests?: Record<
|
||||
string,
|
||||
{
|
||||
number: number;
|
||||
title: string;
|
||||
state: string;
|
||||
merged: boolean;
|
||||
}
|
||||
>;
|
||||
}) {
|
||||
const repository = {
|
||||
findMany: jest.fn(() => Promise.resolve([project])),
|
||||
@@ -46,9 +55,16 @@ describe('ProjectsService', () => {
|
||||
},
|
||||
),
|
||||
),
|
||||
getCommitPullRequest: jest.fn((owner: string, repo: string, sha: string) =>
|
||||
Promise.resolve(options?.pullRequests?.[sha]),
|
||||
),
|
||||
} satisfies Pick<
|
||||
GiteaClient,
|
||||
'healthSummary' | 'listBranches' | 'listTags' | 'getCommit'
|
||||
| 'healthSummary'
|
||||
| 'listBranches'
|
||||
| 'listTags'
|
||||
| 'getCommit'
|
||||
| 'getCommitPullRequest'
|
||||
>;
|
||||
const auth = {
|
||||
listAllowedProjectKeys: jest.fn(() => Promise.resolve([project.key])),
|
||||
@@ -90,6 +106,14 @@ describe('ProjectsService', () => {
|
||||
abc123: { sha: 'abc123', message: 'feat: add platform refs' },
|
||||
def456: { sha: 'def456', message: 'chore: tag release' },
|
||||
},
|
||||
pullRequests: {
|
||||
abc123: {
|
||||
number: 2,
|
||||
title: 'feat: add platform refs',
|
||||
state: 'closed',
|
||||
merged: true,
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
const refs = await service.listProjectRefs(project.key);
|
||||
@@ -101,6 +125,13 @@ describe('ProjectsService', () => {
|
||||
name: 'feature/devops-platform',
|
||||
commitSha: 'abc123',
|
||||
commit: { sha: 'abc123', message: 'feat: add platform refs' },
|
||||
pullRequest: {
|
||||
number: 2,
|
||||
title: 'feat: add platform refs',
|
||||
state: 'closed',
|
||||
merged: true,
|
||||
url: 'https://gitea.ops.mrzhan.top/my-project/access-manage/pulls/2',
|
||||
},
|
||||
},
|
||||
],
|
||||
tags: [
|
||||
|
||||
Reference in New Issue
Block a user