-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: feature test for PullRequestReviewerRemoved event done
- Loading branch information
Showing
4 changed files
with
83 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
test/feature/PullRequest/pullRequestReviewerRemoved.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import {describe, test, afterEach, vi, beforeAll} from "vitest"; | ||
import {CaseSlugs} from "../../../src/enums/CaseSlug"; | ||
import {StrategyTestSetup} from "../strategyTestSetup"; | ||
import PullRequestReviewerRemoved from "../../../src/ActionHandler/PullRequest/PullRequestReviewerRemoved"; | ||
|
||
import pullRequestReviewerRemovedPayload from '../../fixtures/events/pull_request/reviewer/pull_request.reviewer.removed.json'; | ||
|
||
|
||
|
||
describe("Pull Request Opened Tests", () => { | ||
const strategyTestSetup = new StrategyTestSetup(); | ||
|
||
beforeAll(() => { | ||
strategyTestSetup.beforeAll(); | ||
}); | ||
|
||
afterEach(() => { | ||
strategyTestSetup.afterEach(); | ||
}); | ||
|
||
describe.each([ | ||
{ | ||
description: "Reviewer removed", | ||
expectedCaseSlug: CaseSlugs.PullRequest.Reviewer.Removed, | ||
} | ||
])('$description', ({ expectedCaseSlug }) => { | ||
test.only('Creates a comment after receiving the event', async () => { | ||
|
||
strategyTestSetup.actionStrategyHandleSpy = vi.spyOn(PullRequestReviewerRemoved.prototype as any, 'handle'); | ||
|
||
|
||
await strategyTestSetup.probot.receive({ | ||
id: '123', | ||
name: 'pull_request', | ||
payload: pullRequestReviewerRemovedPayload as any, | ||
}); | ||
|
||
|
||
strategyTestSetup.performCommonAssertions(expectedCaseSlug); | ||
|
||
|
||
}); | ||
}); | ||
}); |
File renamed without changes.
38 changes: 38 additions & 0 deletions
38
test/fixtures/events/pull_request/reviewer/pull_request.reviewer.removed.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
{ | ||
"action": "review_request_removed", | ||
"pull_request": { | ||
"id": 1, | ||
"number": 555444, | ||
"state": "open", | ||
"title": "Test Pull Request", | ||
"user": { | ||
"login": "test-user" | ||
}, | ||
"head": { | ||
"ref": "some-side-branch-123" | ||
}, | ||
"base": { | ||
"ref": "master" | ||
}, | ||
"body": "This is a test pull request", | ||
"created_at": "2024-01-01T00:00:00Z", | ||
"updated_at": "2024-01-01T00:00:00Z" | ||
}, | ||
"requested_reviewer": { | ||
"login": "reviewer-user" | ||
}, | ||
"repository": { | ||
"name": "test-repo", | ||
"owner": { | ||
"login": "test-owner" | ||
} | ||
}, | ||
"sender": { | ||
"login": "test-user", | ||
"type": "User" | ||
}, | ||
"installation": { | ||
"id": 1 | ||
}, | ||
"isBot": false | ||
} |