Skip to content

Commit

Permalink
update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
thatportugueseguy committed Oct 9, 2024
1 parent 868908e commit 682a41c
Show file tree
Hide file tree
Showing 13 changed files with 673 additions and 19 deletions.
474 changes: 474 additions & 0 deletions mock_payloads/pull_request.labeled_two_labels_with_thread.json

Large diffs are not rendered by default.

12 changes: 3 additions & 9 deletions mock_payloads/pull_request_review_comment.created.json
Original file line number Diff line number Diff line change
Expand Up @@ -94,15 +94,9 @@
"merged_at": null,
"merge_commit_sha": "3ca0f58f17dc9ac354a3b1b89f289ac16806e860",
"assignee": null,
"assignees": [

],
"requested_reviewers": [

],
"requested_teams": [

],
"assignees": [],
"requested_reviewers": [],
"requested_teams": [],
"labels": [
{
"id": 0,
Expand Down
18 changes: 18 additions & 0 deletions mock_states/pull_request.labeled_two_labels_with_thread.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"pipeline_statuses": {},
"pipeline_commits": {},
"slack_threads": {
"https://github.com/xinyuluo/monorepo/pull/4": [
{
"channel": "a1-bot",
"ts": "1728399554.482879",
"cid": "Ca1bot"
},
{
"channel": "backend",
"ts": "1728399554.444444",
"cid": "Cbackend"
}
]
}
}
13 changes: 13 additions & 0 deletions mock_states/pull_request_review.approved.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"pipeline_statuses": {},
"pipeline_commits": {},
"slack_threads": {
"https://github.com/Khady/monorepo/pull/6": [
{
"channel": "default",
"ts": "1728399554.482879",
"cid": "Cdefault"
}
]
}
}
13 changes: 13 additions & 0 deletions mock_states/pull_request_review.commented.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"pipeline_statuses": {},
"pipeline_commits": {},
"slack_threads": {
"https://github.com/xinyuluo/monorepo/pull/3": [
{
"channel": "frontend-bot",
"ts": "1728399554.482879",
"cid": "Cfebot"
}
]
}
}
13 changes: 13 additions & 0 deletions mock_states/pull_request_review.request_changes.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"pipeline_statuses": {},
"pipeline_commits": {},
"slack_threads": {
"https://github.com/Khady/monorepo/pull/6": [
{
"channel": "default",
"ts": "1728399554.482879",
"cid": "Cdefault"
}
]
}
}
13 changes: 13 additions & 0 deletions mock_states/pull_request_review.submitted_comment.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"pipeline_statuses": {},
"pipeline_commits": {},
"slack_threads": {
"https://github.com/xinyuluo/monorepo/pull/3": [
{
"channel": "frontend-bot",
"ts": "1728399554.482879",
"cid": "Cfebot"
}
]
}
}
18 changes: 18 additions & 0 deletions mock_states/pull_request_review_comment.created.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"pipeline_statuses": {},
"pipeline_commits": {},
"slack_threads": {
"https://github.com/xinyuluo/monorepo/pull/4": [
{
"channel": "a1-bot",
"ts": "1728399554.482879",
"cid": "Ca1bot"
},
{
"channel": "backend",
"ts": "1728399554.444444",
"cid": "Cbackend"
}
]
}
}
3 changes: 2 additions & 1 deletion mock_states/status.commit1-02-failed.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,6 @@
"s1": ["7e0a933e9c71b4ca107680ca958ca1888d5e479b"],
"s2": []
}
}
},
"slack_threads": {}
}
3 changes: 2 additions & 1 deletion mock_states/status.state_hide_success_test.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,6 @@
}
}
},
"pipeline_commits": {}
"pipeline_commits": {},
"slack_threads": {}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,6 @@
}
}
},
"pipeline_commits": {}
"pipeline_commits": {},
"slack_threads": {}
}
109 changes: 102 additions & 7 deletions test/slack_payloads.expected
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ will notify #backend
"fallback": null,
"mrkdwn_in": [ "text" ],
"color": "#ccc",
"text": "Labels: backend"
"text": "*Labels*: _backend_"
}
],
"unfurl_links": false
Expand Down Expand Up @@ -286,31 +286,34 @@ will notify #default
"text": "<https://github.com/xinyuluo/monorepo|[xinyuluo/monorepo]> Pull request #2 <https://github.com/xinyuluo/monorepo/pull/2|Update README.md> merged by *xinyuluo*",
"unfurl_links": false
}
===== file ../mock_payloads/pull_request.labeled_two_labels.json =====
===== file ../mock_payloads/pull_request.labeled_two_labels_no_thread.json =====
===== file ../mock_payloads/pull_request.labeled_two_labels_with_thread.json =====
will notify #a1-bot
{
"channel": "a1-bot",
"thread_ts": "1728399554.482879",
"text": "<https://github.com/xinyuluo/monorepo|[xinyuluo/monorepo]> Pull request #4 <https://github.com/xinyuluo/monorepo/pull/4|README update> labeled by *xinyuluo*",
"attachments": [
{
"fallback": null,
"mrkdwn_in": [ "text" ],
"color": "#ccc",
"text": "Labels: a1, backend"
"text": "*Labels*: _a1_, _backend_"
}
],
"unfurl_links": false
}
will notify #backend
{
"channel": "backend",
"thread_ts": "1728399554.444444",
"text": "<https://github.com/xinyuluo/monorepo|[xinyuluo/monorepo]> Pull request #4 <https://github.com/xinyuluo/monorepo/pull/4|README update> labeled by *xinyuluo*",
"attachments": [
{
"fallback": null,
"mrkdwn_in": [ "text" ],
"color": "#ccc",
"text": "Labels: a1, backend"
"text": "*Labels*: _a1_, _backend_"
}
],
"unfurl_links": false
Expand All @@ -325,7 +328,7 @@ will notify #frontend-bot
"fallback": null,
"mrkdwn_in": [ "text" ],
"color": "#ccc",
"text": ""
"text": "*Labels*: _enhancement_"
}
],
"unfurl_links": false
Expand All @@ -351,6 +354,21 @@ will notify #default
{
"channel": "default",
"text": "<https://github.com/Khady/monorepo|[Khady/monorepo]> *Khady* <https://github.com/Khady/monorepo/pull/6#pullrequestreview-0|approved> #6 <https://github.com/Khady/monorepo/pull/6|create pr_review_test.md>",
"attachments": [
{
"fallback": null,
"mrkdwn_in": [ "text" ],
"color": "#ccc",
"text": "*Comment*: approve review"
}
],
"unfurl_links": false
}
will notify #default
{
"channel": "default",
"thread_ts": "1728399554.482879",
"text": "<https://github.com/Khady/monorepo|[Khady/monorepo]> *Khady* <https://github.com/Khady/monorepo/pull/6#pullrequestreview-0|approved> #6 <https://github.com/Khady/monorepo/pull/6|create pr_review_test.md>",
"attachments": [
{
"fallback": null,
Expand All @@ -365,7 +383,22 @@ will notify #default
will notify #frontend-bot
{
"channel": "frontend-bot",
"text": "<https://github.com/xinyuluo/monorepo|[xinyuluo/monorepo]> *xinyuluo* <https://github.com/xinyuluo/monorepo/pull/3#pullrequestreview-0|commented on> #3 <https://github.com/xinyuluo/monorepo/pull/3|Update README.md>",
"text": "<https://github.com/xinyuluo/monorepo|[xinyuluo/monorepo]> *xinyuluo* <https://github.com/xinyuluo/monorepo/pull/3#pullrequestreview-0|reviewed> #3 <https://github.com/xinyuluo/monorepo/pull/3|Update README.md>",
"attachments": [
{
"fallback": null,
"mrkdwn_in": [ "text" ],
"color": "#ccc",
"text": "*Comment*: submit a PR review"
}
],
"unfurl_links": false
}
will notify #frontend-bot
{
"channel": "frontend-bot",
"thread_ts": "1728399554.482879",
"text": "<https://github.com/xinyuluo/monorepo|[xinyuluo/monorepo]> *xinyuluo* <https://github.com/xinyuluo/monorepo/pull/3#pullrequestreview-0|reviewed> #3 <https://github.com/xinyuluo/monorepo/pull/3|Update README.md>",
"attachments": [
{
"fallback": null,
Expand All @@ -383,6 +416,21 @@ will notify #default
{
"channel": "default",
"text": "<https://github.com/Khady/monorepo|[Khady/monorepo]> *Khady* <https://github.com/Khady/monorepo/pull/6#pullrequestreview-0|requested changes on> #6 <https://github.com/Khady/monorepo/pull/6|create pr_review_test.md>",
"attachments": [
{
"fallback": null,
"mrkdwn_in": [ "text" ],
"color": "#ccc",
"text": "*Comment*: request changes review"
}
],
"unfurl_links": false
}
will notify #default
{
"channel": "default",
"thread_ts": "1728399554.482879",
"text": "<https://github.com/Khady/monorepo|[Khady/monorepo]> *Khady* <https://github.com/Khady/monorepo/pull/6#pullrequestreview-0|requested changes on> #6 <https://github.com/Khady/monorepo/pull/6|create pr_review_test.md>",
"attachments": [
{
"fallback": null,
Expand All @@ -397,7 +445,22 @@ will notify #default
will notify #frontend-bot
{
"channel": "frontend-bot",
"text": "<https://github.com/xinyuluo/monorepo|[xinyuluo/monorepo]> *xinyuluo* <https://github.com/xinyuluo/monorepo/pull/3#pullrequestreview-0|commented on> #3 <https://github.com/xinyuluo/monorepo/pull/3|Update README.md>",
"text": "<https://github.com/xinyuluo/monorepo|[xinyuluo/monorepo]> *xinyuluo* <https://github.com/xinyuluo/monorepo/pull/3#pullrequestreview-0|reviewed> #3 <https://github.com/xinyuluo/monorepo/pull/3|Update README.md>",
"attachments": [
{
"fallback": null,
"mrkdwn_in": [ "text" ],
"color": "#ccc",
"text": "*Comment*: This is a great PR, thank you!"
}
],
"unfurl_links": false
}
will notify #frontend-bot
{
"channel": "frontend-bot",
"thread_ts": "1728399554.482879",
"text": "<https://github.com/xinyuluo/monorepo|[xinyuluo/monorepo]> *xinyuluo* <https://github.com/xinyuluo/monorepo/pull/3#pullrequestreview-0|reviewed> #3 <https://github.com/xinyuluo/monorepo/pull/3|Update README.md>",
"attachments": [
{
"fallback": null,
Expand All @@ -411,6 +474,38 @@ will notify #frontend-bot
===== file ../mock_payloads/pull_request_review.submitted_no_comment.json =====
===== file ../mock_payloads/pull_request_review.submitted_null_body.json =====
===== file ../mock_payloads/pull_request_review_comment.created.json =====
will notify #a1-bot
{
"channel": "a1-bot",
"thread_ts": "1728399554.482879",
"text": "<https://github.com/xinyuluo/monorepo|[xinyuluo/monorepo]> *xinyuluo* commented on #4 <https://github.com/xinyuluo/monorepo/pull/4|README update>",
"attachments": [
{
"fallback": null,
"mrkdwn_in": [ "text" ],
"color": "#ccc",
"text": "PR review comment example",
"footer": "Commented in file <https://github.com/xinyuluo/monorepo/pull/4#discussion_r0|README.md>"
}
],
"unfurl_links": false
}
will notify #backend
{
"channel": "backend",
"thread_ts": "1728399554.444444",
"text": "<https://github.com/xinyuluo/monorepo|[xinyuluo/monorepo]> *xinyuluo* commented on #4 <https://github.com/xinyuluo/monorepo/pull/4|README update>",
"attachments": [
{
"fallback": null,
"mrkdwn_in": [ "text" ],
"color": "#ccc",
"text": "PR review comment example",
"footer": "Commented in file <https://github.com/xinyuluo/monorepo/pull/4#discussion_r0|README.md>"
}
],
"unfurl_links": false
}
===== file ../mock_payloads/pull_request_review_comment.deleted.json =====
===== file ../mock_payloads/pull_request_review_comment.edited.json =====
===== file ../mock_payloads/push.branch_filter_default.json =====
Expand Down

0 comments on commit 682a41c

Please sign in to comment.