Skip to content

Commit b84002f

Browse files
authored
Merge pull request #2530 from RealDevSquad/develop
dev to main sync
2 parents 99de6da + 46ff1bb commit b84002f

File tree

3 files changed

+3
-4
lines changed

3 files changed

+3
-4
lines changed

middlewares/validators/oooRequests.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export const createOooStatusRequestValidator = async (
1414
.keys({
1515
from: joi
1616
.number()
17-
.min(Date.now())
17+
.min(new Date().setUTCHours(0, 0, 0, 0))
1818
.messages({
1919
"number.min": "from date must be greater than or equal to Today's date",
2020
})

test/integration/requests.test.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -425,7 +425,6 @@ describe("/requests OOO", function () {
425425
done();
426426
});
427427
});
428-
429428
it("should approve OOO request", function (done) {
430429
chai
431430
.request(app)

test/unit/middlewares/oooRequests.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ describe("OOO Status Request Validators", function () {
3131
res = {};
3232

3333
await createOooStatusRequestValidator(req as any, res as any, nextSpy);
34-
expect(nextSpy.calledOnce);
34+
expect(nextSpy.notCalled).to.be.true;
3535
});
3636

3737
it("should not validate for an invalid request on wrong type", async function () {
@@ -82,7 +82,7 @@ describe("OOO Status Request Validators", function () {
8282

8383
it("should not validate for an invalid request if all until date is greater than from", async function () {
8484
req = {
85-
body: { ...validOooStatusRequests, from: Date.now() + 5000000, until: Date.now() + 1000000 },
85+
body: { ...validOooStatusRequests, from: new Date().setUTCHours(0, 0, 0, 0) + 5000000, until: new Date().setUTCHours(0, 0, 0, 0) + 1000000 },
8686
};
8787
try {
8888
await createOooStatusRequestValidator(req as any, res as any, nextSpy);

0 commit comments

Comments
 (0)