Skip to content

Commit a34a422

Browse files
committed
fix(tests): temporarily disable user reply in errorReply tests
fix(errorReply): comment out user reply in error handling
1 parent e857620 commit a34a422

3 files changed

Lines changed: 13 additions & 5 deletions

File tree

__tests__/utils/errorReply.test.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,18 +31,18 @@ describe("errorReply util", () => {
3131

3232
await errorReply(ctx, error);
3333

34-
// Reply به کاربر
35-
expect(mockReply).toHaveBeenCalledWith("خطایی رخ داده است! 🤖");
34+
// User Reply - Temporarily disabled
35+
// expect(mockReply).toHaveBeenCalledWith("خطایی رخ داده است! 🤖");
3636

37-
// پیام به ادمین
37+
// Message to Admin Group
3838
expect(mockSendMessage).toHaveBeenCalledTimes(1);
3939
const sentText = mockSendMessage.mock.calls[0][1];
4040
expect(sentText).toContain("⚠️ *خطایی رخ داده است!*");
4141
expect(sentText).toContain("TestChat");
4242
expect(sentText).toContain("Alice");
4343
expect(sentText).toContain("Something went wrong");
4444

45-
// گزینه parse_mode
45+
// parse_mode
4646
expect(mockSendMessage.mock.calls[0][2]).toEqual({
4747
parse_mode: "Markdown",
4848
});

bot/services/azure.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,18 @@ async function createWorkItem(ctx, userData, isNewID) {
1616
return;
1717
}
1818

19+
// console.log("Creating work item for user:", userData); // Debug log
20+
1921
try {
22+
// console.log(ORGANIZATION, PROJECT, WORKITEM_ID); // Debug log
23+
2024
const res = await axios.get(
2125
`https://dev.azure.com/${ORGANIZATION}/${PROJECT}/_apis/wit/workitems/${WORKITEM_ID}?api-version=7.1-preview.3`,
2226
{ headers: { Authorization: AUTH } }
2327
);
2428

29+
// console.log("Original Work Item:", res.data); // Debug log
30+
2531
const originalWorkItem = res.data;
2632
const fieldsToCopy = {
2733
"System.Title": `Entrance Path: @${userData.username} - ${
@@ -56,6 +62,8 @@ async function createWorkItem(ctx, userData, isNewID) {
5662
},
5763
});
5864

65+
// console.log("Payload for new Work Item:", payload); // Debug log
66+
5967
await axios.post(
6068
`https://dev.azure.com/${ORGANIZATION}/${PROJECT}/_apis/wit/workitems/$Product%20Backlog%20Item?api-version=7.1-preview.3`,
6169
payload,

bot/utils/errorReply.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
const { ADMIN_GROUP_ID } = require("../config/config");
22

33
const errorReply = async (ctx, error) => {
4-
await ctx.reply("خطایی رخ داده است! 🤖");
4+
// await ctx.reply("خطایی رخ داده است! 🤖"); // Only in TEST
55

66
let errorText = "⚠️ *خطایی رخ داده است!*\n\n";
77

0 commit comments

Comments
 (0)