From 6e2aa89615ea210f4a8d75420bfe06e263ed9902 Mon Sep 17 00:00:00 2001 From: Pankaj Sha Date: Mon, 6 Jan 2025 16:57:18 +0530 Subject: [PATCH] chore: fix lint issue --- controllers/onboardingExtension.ts | 11 ++++++-- test/integration/onboardingExtension.test.ts | 27 ++++++++++++++------ 2 files changed, 28 insertions(+), 10 deletions(-) diff --git a/controllers/onboardingExtension.ts b/controllers/onboardingExtension.ts index 7972fb55c..d08897897 100644 --- a/controllers/onboardingExtension.ts +++ b/controllers/onboardingExtension.ts @@ -39,7 +39,11 @@ import { convertDaysToMilliseconds } from "../utils/time"; * @param {OnboardingExtensionResponse} res - The Express response object used to send back the response. * @returns {Promise} Resolves to a response with the status and data or an error message. */ -export const createOnboardingExtensionRequestController = async (req: OnboardingExtensionCreateRequest, res: OnboardingExtensionResponse): Promise => { +export const createOnboardingExtensionRequestController = async ( + req: OnboardingExtensionCreateRequest, + res: OnboardingExtensionResponse ) + : Promise => { + try { const data = req.body as CreateOnboardingExtensionBody; @@ -135,7 +139,10 @@ export const createOnboardingExtensionRequestController = async (req: Onboarding * @param {OnboardingExtensionResponse} res - The response object to send the result of the update. * @returns {Promise} Sends the response with the result of the update operation. */ -export const updateOnboardingExtensionRequestState = async (req: UpdateOnboardingExtensionStateRequest, res: OnboardingExtensionResponse): Promise => { +export const updateOnboardingExtensionRequestState = async ( + req: UpdateOnboardingExtensionStateRequest, + res: OnboardingExtensionResponse ) + : Promise => { const dev = req.query.dev === "true"; diff --git a/test/integration/onboardingExtension.test.ts b/test/integration/onboardingExtension.test.ts index f1b55d88a..dd5d3d481 100644 --- a/test/integration/onboardingExtension.test.ts +++ b/test/integration/onboardingExtension.test.ts @@ -306,7 +306,7 @@ describe("/requests Onboarding Extension", () => { type: REQUEST_TYPE.ONBOARDING, state: REQUEST_STATE.APPROVED, message: "test-message" - } + }; let latestExtension: OnboardingExtension; let userId: string; let putEndpoint: string; @@ -315,13 +315,25 @@ describe("/requests Onboarding Extension", () => { let latestRejectedExtension: OnboardingExtension; beforeEach(async () => { - userId = await addUser(userData[4]) - latestExtension = await requestsQuery.createRequest({state: REQUEST_STATE.PENDING, type: REQUEST_TYPE.ONBOARDING, requestNumber: 1}); - latestApprovedExtension = await requestsQuery.createRequest({state: REQUEST_STATE.APPROVED, type: REQUEST_TYPE.ONBOARDING, requestNumber: 2}); - latestRejectedExtension = await requestsQuery.createRequest({state: REQUEST_STATE.REJECTED, type: REQUEST_TYPE.ONBOARDING, requestNumber: 2}); + userId = await addUser(userData[4]); + latestExtension = await requestsQuery.createRequest({ + state: REQUEST_STATE.PENDING, + type: REQUEST_TYPE.ONBOARDING, + requestNumber: 1 + }); + latestApprovedExtension = await requestsQuery.createRequest({ + state: REQUEST_STATE.APPROVED, + type: REQUEST_TYPE.ONBOARDING, requestNumber: 2 + }); + latestRejectedExtension = await requestsQuery.createRequest({ + state: REQUEST_STATE.REJECTED, + type: REQUEST_TYPE.ONBOARDING, + requestNumber: 2 + }); putEndpoint = `/requests/${latestExtension.id}?dev=true`; authToken = generateAuthToken({userId}); }) + afterEach(async () => { sinon.restore(); await cleanDb(); @@ -336,7 +348,7 @@ describe("/requests Onboarding Extension", () => { if(err) return done(err); expect(res.statusCode).to.equal(401); expect(res.body.error).to.equal("Unauthorized"); - expect(res.body.message).to.equal("You are not authorized for this action.") + expect(res.body.message).to.equal("You are not authorized for this action."); done(); }) }) @@ -369,8 +381,7 @@ describe("/requests Onboarding Extension", () => { }) it("should return Unauthenticated User when authorization header is missing", (done) => { - chai - .request(app) + chai.request(app) .put(putEndpoint) .set("authorization", "") .send(body)