Api refactor, return object for getComparison

Signed-off-by: Erik Engervall <erik.engervall@gmail.com>
This commit is contained in:
Erik Engervall
2021-04-30 14:10:05 +02:00
parent 71943aad09
commit bd2bf2620b
3 changed files with 13 additions and 7 deletions
@@ -282,8 +282,10 @@ export class GitReleaseApiClient implements GitReleaseApi {
});
return {
htmlUrl: compareCommitsResponse.data.html_url,
aheadBy: compareCommitsResponse.data.ahead_by,
comparison: {
htmlUrl: compareCommitsResponse.data.html_url,
aheadBy: compareCommitsResponse.data.ahead_by,
},
};
};
@@ -617,8 +619,10 @@ export interface GitReleaseApi {
head: string;
} & OwnerRepo,
) => Promise<{
htmlUrl: string;
aheadBy: number;
comparison: {
htmlUrl: string;
aheadBy: number;
};
}>;
createRelease: (
@@ -197,7 +197,7 @@ export function useCreateReleaseCandidate({
? latestRelease.targetCommitish
: defaultBranch;
const nextReleaseBranch = releaseCandidateGitInfo.rcBranch;
const comparison = await pluginApiClient
const { comparison } = await pluginApiClient
.getComparison({
owner: project.owner,
repo: project.repo,
@@ -244,8 +244,10 @@ export const mockApiClient: GitReleaseApi = {
})),
getComparison: jest.fn(async () => ({
htmlUrl: 'mock_compareCommits_html_url',
aheadBy: 1,
comparison: {
htmlUrl: 'mock_compareCommits_html_url',
aheadBy: 1,
},
})),
createTagObject: jest.fn(async () => ({