Skip to content

Commit

Permalink
testing numeric value in minduration
Browse files Browse the repository at this point in the history
  • Loading branch information
jose-carlos-sousa committed Mar 13, 2024
1 parent 2577513 commit e0d1712
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions test/end-to-end/offer.js
Original file line number Diff line number Diff line change
Expand Up @@ -232,13 +232,6 @@ describe("Offer endpoint tests", () => {
FieldValidatorTester.mustBeFuture();
FieldValidatorTester.mustBeAfter("publishDate");
});
describe("jobMinDuration", () => {
const FieldValidatorTester = BodyValidatorTester("jobMinDuration");
if (BodyValidatorTester("jobType") !== "FREELANCE") {
FieldValidatorTester.isRequired();
FieldValidatorTester.mustBeNumber();
}
});
describe("jobMaxDuration", () => {
const FieldValidatorTester = BodyValidatorTester("jobMaxDuration");
FieldValidatorTester.isRequired();
Expand Down Expand Up @@ -707,6 +700,19 @@ describe("Offer endpoint tests", () => {
expect(res.status).toBe(HTTPStatus.UNPROCESSABLE_ENTITY);
});

test("should fail jobMinDuration isn't numeric value", async () => {
const offer_params = generateTestOffer({
jobMaxDuration: 8,
jobMinDuration: "nonNumeric",
owner: test_company._id,
});
const res = await request()
.post("/offers/new")
.send(withGodToken(offer_params));
expect(res.status).toBe(HTTPStatus.UNPROCESSABLE_ENTITY);
});


test("should succeed if jobMaxDuration is greater than jobMinDuration", async () => {
const offer_params = generateTestOffer({
jobMinDuration: 8,
Expand Down

0 comments on commit e0d1712

Please sign in to comment.