diff --git a/middlewares/validators/oooRequests.ts b/middlewares/validators/oooRequests.ts index e2db46a82..4c4fb3f22 100644 --- a/middlewares/validators/oooRequests.ts +++ b/middlewares/validators/oooRequests.ts @@ -14,7 +14,7 @@ export const createOooStatusRequestValidator = async ( .keys({ from: joi .number() - .min(Date.now()) + .min(new Date().setUTCHours(0, 0, 0, 0)) .messages({ "number.min": "from date must be greater than or equal to Today's date", }) diff --git a/test/integration/requests.test.ts b/test/integration/requests.test.ts index be8267951..bfc5b214a 100644 --- a/test/integration/requests.test.ts +++ b/test/integration/requests.test.ts @@ -425,7 +425,6 @@ describe("/requests OOO", function () { done(); }); }); - it("should approve OOO request", function (done) { chai .request(app) diff --git a/test/unit/middlewares/oooRequests.test.ts b/test/unit/middlewares/oooRequests.test.ts index f8b4c103c..a7fac17c1 100644 --- a/test/unit/middlewares/oooRequests.test.ts +++ b/test/unit/middlewares/oooRequests.test.ts @@ -31,7 +31,7 @@ describe("OOO Status Request Validators", function () { res = {}; await createOooStatusRequestValidator(req as any, res as any, nextSpy); - expect(nextSpy.calledOnce); + expect(nextSpy.notCalled).to.be.true; }); it("should not validate for an invalid request on wrong type", async function () { @@ -82,7 +82,7 @@ describe("OOO Status Request Validators", function () { it("should not validate for an invalid request if all until date is greater than from", async function () { req = { - body: { ...validOooStatusRequests, from: Date.now() + 5000000, until: Date.now() + 1000000 }, + body: { ...validOooStatusRequests, from: new Date().setUTCHours(0, 0, 0, 0) + 5000000, until: new Date().setUTCHours(0, 0, 0, 0) + 1000000 }, }; try { await createOooStatusRequestValidator(req as any, res as any, nextSpy);