Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion middlewares/validators/oooRequests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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",
})
Expand Down
1 change: 0 additions & 1 deletion test/integration/requests.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,6 @@ describe("/requests OOO", function () {
done();
});
});

it("should approve OOO request", function (done) {
chai
.request(app)
Expand Down
4 changes: 2 additions & 2 deletions test/unit/middlewares/oooRequests.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 () {
Expand Down Expand Up @@ -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);
Expand Down
Loading