Skip to content

Commit 5d33e61

Browse files
committed
test(assign): restore deleted-comment reaction failure mock after rebase
Signed-off-by: darshit2308 <darshit2308@gmail.com>
1 parent 88340ac commit 5d33e61

File tree

1 file changed

+15
-8
lines changed

1 file changed

+15
-8
lines changed

.github/scripts/tests/test-assign-bot.js

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ function createMockGithub(options = {}) {
2727
assignShouldFail = false,
2828
removeLabelShouldFail = false,
2929
addLabelShouldFail = false,
30+
reactionShouldFail = false,
3031
issueGetShouldFail = false,
3132
issueAssignees = null,
3233
} = options;
@@ -45,6 +46,11 @@ function createMockGithub(options = {}) {
4546
rest: {
4647
reactions: {
4748
createForIssueComment: async (params) => {
49+
if (reactionShouldFail) {
50+
throw new Error(
51+
"Simulated reaction failure: comment not found (404)",
52+
);
53+
}
4854
calls.reactions.push({
4955
commentId: params.comment_id,
5056
content: params.content,
@@ -1247,26 +1253,27 @@ Error details: Failed to remove 'status: ready for dev': Simulated remove label
12471253
// ---------------------------------------------------------------------------
12481254

12491255
{
1250-
name: 'Abort - Triggering Comment Deleted',
1251-
description: 'Bot aborts /assign flow when acknowledgeComment fails (comment deleted)',
1256+
name: "Abort - Triggering Comment Deleted",
1257+
description:
1258+
"Bot aborts /assign flow when acknowledgeComment fails (comment deleted)",
12521259
context: {
1253-
eventName: 'issue_comment',
1260+
eventName: "issue_comment",
12541261
payload: {
12551262
issue: {
12561263
number: 400,
12571264
assignees: [],
12581265
labels: [
1259-
{ name: 'status: ready for dev' },
1260-
{ name: 'skill: good first issue' },
1266+
{ name: "status: ready for dev" },
1267+
{ name: "skill: good first issue" },
12611268
],
12621269
},
12631270
comment: {
12641271
id: 4001,
1265-
body: '/assign',
1266-
user: { login: 'deleted-comment-user', type: 'User' },
1272+
body: "/assign",
1273+
user: { login: "deleted-comment-user", type: "User" },
12671274
},
12681275
},
1269-
repo: { owner: 'hiero-ledger', repo: 'hiero-sdk-cpp' },
1276+
repo: { owner: "hiero-ledger", repo: "hiero-sdk-cpp" },
12701277
},
12711278
githubOptions: { reactionShouldFail: true },
12721279
expectedAssignee: null,

0 commit comments

Comments
 (0)