Skip to content

Commit

Permalink
refactor: add message in constant responses
Browse files Browse the repository at this point in the history
  • Loading branch information
tejaskh3 committed May 5, 2024
1 parent 46ad626 commit cad3f65
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 2 additions & 0 deletions src/constants/responses.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,3 +77,5 @@ export const INVALID_TOKEN_FORMAT =
"Invalid Authentication header format. Expected 'Bearer <token>'";

export const AUTHENTICATION_ERROR = "Invalid Authentication token";
export const TASK_UPDATE_SENT_MESSAGE =
"Task update sent on Discord's tracking-updates channel.";
4 changes: 1 addition & 3 deletions src/controllers/taskUpdatesHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,7 @@ export const sendTaskUpdatesHandler = async (request: IRequest, env: env) => {
taskTitle,
env
);
return new JSONResponse(
"Task update sent on Discord's tracking-updates channel."
);
return new JSONResponse(response.TASK_UPDATE_SENT_MESSAGE);
} catch (error: any) {
return new JSONResponse({
res: response.INTERNAL_SERVER_ERROR,
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/handlers/taskUpdateHandler.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,6 @@ describe("sendTaskUpdatesHandler", () => {
);
expect(result.status).toBe(200);
const res: JSONResponse = await result.json();
expect(res).toBe("Task update sent on Discord's tracking-updates channel.");
expect(res).toBe(response.TASK_UPDATE_SENT_MESSAGE);
});
});

0 comments on commit cad3f65

Please sign in to comment.