Skip to content

Commit

Permalink
refactor(gitea): Support state changes for updatePr (#7015)
Browse files Browse the repository at this point in the history
  • Loading branch information
zharinov committed Aug 18, 2020
1 parent 5230f28 commit b0102b6
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
16 changes: 16 additions & 0 deletions lib/platform/gitea/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -854,6 +854,22 @@ describe('platform/gitea', () => {
body: 'New Body',
});
});

it('should close pull request', async () => {
await initFakeRepo();
await gitea.updatePr({
number: 1,
prTitle: 'New Title',
prBody: 'New Body',
state: PrState.Closed,
});

expect(helper.updatePR).toHaveBeenCalledWith(mockRepo.full_name, 1, {
title: 'New Title',
body: 'New Body',
state: PrState.Closed,
});
});
});

describe('mergePr', () => {
Expand Down
2 changes: 2 additions & 0 deletions lib/platform/gitea/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -569,10 +569,12 @@ const platform: Platform = {
number,
prTitle: title,
prBody: body,
state,
}: UpdatePrConfig): Promise<void> {
await helper.updatePR(config.repository, number, {
title,
...(body && { body }),
...(state && { state }),
});
},

Expand Down

0 comments on commit b0102b6

Please sign in to comment.