Skip to content

Commit

Permalink
chore: remove usages of it.each in unit tests (#169)
Browse files Browse the repository at this point in the history
  • Loading branch information
danadajian authored Mar 30, 2022
1 parent f9709ce commit c1f637b
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 6 deletions.
4 changes: 2 additions & 2 deletions test/helpers/assign-pr-reviewers.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,9 @@ describe('assignPrReviewer', () => {
await assignPrReviewers({ teams, slack_webhook_url });
});

it.each(['assignee'])('should call notifyUser with correct params', assignee => {
it('should call notifyUser with correct params', () => {
expect(notifyUser).toHaveBeenCalledWith({
login: assignee,
login: 'assignee',
pull_number,
slack_webhook_url
});
Expand Down
18 changes: 16 additions & 2 deletions test/helpers/notify-pipeline-complete.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,23 @@ describe('setOpenPullRequestStatus', () => {
});
});

it.each(['sha 1', 'sha 2', 'sha 3'])('should call createCommitStatus with correct params', sha => {
it('should call createCommitStatus with correct params', () => {
expect(octokit.repos.createCommitStatus).toHaveBeenCalledWith({
sha,
sha: 'sha 1',
context: DEFAULT_PIPELINE_STATUS,
state: 'success',
description,
...context.repo
});
expect(octokit.repos.createCommitStatus).toHaveBeenCalledWith({
sha: 'sha 2',
context: DEFAULT_PIPELINE_STATUS,
state: 'success',
description,
...context.repo
});
expect(octokit.repos.createCommitStatus).toHaveBeenCalledWith({
sha: 'sha 3',
context: DEFAULT_PIPELINE_STATUS,
state: 'success',
description,
Expand Down
12 changes: 10 additions & 2 deletions test/helpers/set-commit-status.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,18 @@ describe('setCommitStatus', () => {
});
});

it.each(['context1', 'context2'])('should call createCommitStatus with correct params', context => {
it('should call createCommitStatus with correct params', () => {
expect(octokit.repos.createCommitStatus).toHaveBeenCalledWith({
sha,
context,
context: 'context1',
state,
description,
target_url,
...githubContext.repo
});
expect(octokit.repos.createCommitStatus).toHaveBeenCalledWith({
sha,
context: 'context2',
state,
description,
target_url,
Expand Down

0 comments on commit c1f637b

Please sign in to comment.