Skip to content

Commit

Permalink
fix: add value closedAt and mergedAt dynamically
Browse files Browse the repository at this point in the history
  • Loading branch information
adelkahomolova committed Dec 6, 2019
1 parent 422f962 commit cf4bf51
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions test/helpers/bitbucketNock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,12 +127,26 @@ export class BitbucketNock {
if (typeof states !== 'string') {
states.forEach((state) => {
const pullrequest = _.cloneDeep(getPullRequestResponse);

pullrequest.state = state;
pullrequest.closedAt =
pullrequest.state === BitbucketPullRequestState.closed || pullrequest.state === BitbucketPullRequestState.declined
? pullrequest.updatedAt
: null;
pullrequest.mergedAt = pullrequest.state === BitbucketPullRequestState.closed ? pullrequest.updatedAt : null;

pullRequests.push(pullrequest);
});

paginatedPullrequests.items = pullRequests;
} else {
getPullRequestResponse.state = states;
getPullRequestResponse.closedAt =
states === BitbucketPullRequestState.closed || states === BitbucketPullRequestState.declined
? getPullRequestResponse.updatedAt
: null;
getPullRequestResponse.mergedAt = states === BitbucketPullRequestState.closed ? getPullRequestResponse.updatedAt : null;

paginatedPullrequests.items = [getPullRequestResponse];
}
return paginatedPullrequests;
Expand Down

0 comments on commit cf4bf51

Please sign in to comment.