Skip to content

Commit 02c7145

Browse files
testing numeric value in minduration
1 parent 2577513 commit 02c7145

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

test/end-to-end/offer.js

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -234,10 +234,8 @@ describe("Offer endpoint tests", () => {
234234
});
235235
describe("jobMinDuration", () => {
236236
const FieldValidatorTester = BodyValidatorTester("jobMinDuration");
237-
if (BodyValidatorTester("jobType") !== "FREELANCE") {
238-
FieldValidatorTester.isRequired();
239-
FieldValidatorTester.mustBeNumber();
240-
}
237+
FieldValidatorTester.isRequired();
238+
FieldValidatorTester.mustBeNumber();
241239
});
242240
describe("jobMaxDuration", () => {
243241
const FieldValidatorTester = BodyValidatorTester("jobMaxDuration");
@@ -707,6 +705,19 @@ describe("Offer endpoint tests", () => {
707705
expect(res.status).toBe(HTTPStatus.UNPROCESSABLE_ENTITY);
708706
});
709707

708+
test("should fail jobMinDuration isn't numeric value", async () => {
709+
const offer_params = generateTestOffer({
710+
jobMaxDuration: 8,
711+
jobMinDuration: "nonNumeric",
712+
owner: test_company._id,
713+
});
714+
const res = await request()
715+
.post("/offers/new")
716+
.send(withGodToken(offer_params));
717+
expect(res.status).toBe(HTTPStatus.UNPROCESSABLE_ENTITY);
718+
});
719+
720+
710721
test("should succeed if jobMaxDuration is greater than jobMinDuration", async () => {
711722
const offer_params = generateTestOffer({
712723
jobMinDuration: 8,

0 commit comments

Comments
 (0)