Skip to content

Commit

Permalink
chore: fix lint issue
Browse files Browse the repository at this point in the history
  • Loading branch information
pankajjs committed Jan 6, 2025
1 parent 0fb1160 commit 6e2aa89
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 10 deletions.
11 changes: 9 additions & 2 deletions controllers/onboardingExtension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,11 @@ import { convertDaysToMilliseconds } from "../utils/time";
* @param {OnboardingExtensionResponse} res - The Express response object used to send back the response.
* @returns {Promise<OnboardingExtensionResponse>} Resolves to a response with the status and data or an error message.
*/
export const createOnboardingExtensionRequestController = async (req: OnboardingExtensionCreateRequest, res: OnboardingExtensionResponse): Promise<OnboardingExtensionResponse> => {
export const createOnboardingExtensionRequestController = async (
req: OnboardingExtensionCreateRequest,
res: OnboardingExtensionResponse )
: Promise<OnboardingExtensionResponse> => {

try {

const data = req.body as CreateOnboardingExtensionBody;
Expand Down Expand Up @@ -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<OnboardingExtensionResponse>} Sends the response with the result of the update operation.
*/
export const updateOnboardingExtensionRequestState = async (req: UpdateOnboardingExtensionStateRequest, res: OnboardingExtensionResponse): Promise<OnboardingExtensionResponse> => {
export const updateOnboardingExtensionRequestState = async (
req: UpdateOnboardingExtensionStateRequest,
res: OnboardingExtensionResponse )
: Promise<OnboardingExtensionResponse> => {

const dev = req.query.dev === "true";

Expand Down
27 changes: 19 additions & 8 deletions test/integration/onboardingExtension.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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();
Expand All @@ -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();
})
})
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 6e2aa89

Please sign in to comment.