Skip to content

Commit

Permalink
write tests for job
Browse files Browse the repository at this point in the history
  • Loading branch information
447011 committed Mar 7, 2022
1 parent e2fc2ad commit d1cf100
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions tests/business-logic/Job.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,22 @@ describe("Job", () => {
expect(job.title).toBe(requestParams.title);
expect(job.description).toBe(requestParams.description);
});

it("throws error if user was not found", async () => {
await minimalSetup();

const requestParams = {
title: "Software Engineer",
description: "You write code.",
};

const nonExistingUserId = 99999;
const entity = new JobEntity();

await expect(async () => {
await entity.create(requestParams, nonExistingUserId);
}).rejects.toThrowError("Not found");
});
});

describe("#list", () => {
Expand All @@ -41,5 +57,16 @@ describe("Job", () => {

expect(result.length).toBe(2);
});

it("throws error if user was not found", async () => {
await minimalSetup();

const nonExistingUserId = 99999;
const entity = new JobEntity();

await expect(async () => {
await entity.list(nonExistingUserId);
}).rejects.toThrowError("Not found");
});
});
});

0 comments on commit d1cf100

Please sign in to comment.