Skip to content

Commit

Permalink
New jest test
Browse files Browse the repository at this point in the history
  • Loading branch information
MrRibcage committed Jun 27, 2024
1 parent dc10d78 commit 9fdba56
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions test/challenges-platform/services/reviews-service.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,29 @@ describe("ReviewsService", () => {
expect(result.val.comment).toBe(body);
});
});
describe("when submission has already been reviewed", () => {
it("returns an error", async () => {
const [challenge, participant] = await accessibleChallengeFactory();
const submission = await submissionFactory({
challenge: challenge,
participant: participant,
});
const body = "Nice work";
await reviewFactory({
submission: submission,
body: body,
});

const result = await ReviewsService.create(
Status.APPROVED,
submission.id,
body,
);

expect(result.err).toBe(true);
expect(result.val.toString()).toBe("Error: Submission has already been reviewed");
});
});
describe("when submission does not exist", () => {
it("returns an error", async () => {
const invalidId = -1;
Expand Down

0 comments on commit 9fdba56

Please sign in to comment.