Skip to content

Commit

Permalink
chore: add two more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
RishikeshNK committed Nov 22, 2024
1 parent f9f61a2 commit 7373516
Showing 1 changed file with 31 additions and 1 deletion.
32 changes: 31 additions & 1 deletion packages/api/tests/review.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ describe("Review Router", async () => {
expect(reviews).toEqual(data);

expect(db.query.Review.findMany).toHaveBeenCalledWith({
orderBy: desc(Review.id),
orderBy: expect.anything(),
where: undefined,
});
});
Expand All @@ -69,4 +69,34 @@ describe("Review Router", async () => {
where: and(eq(Review.workTerm, "SPRING")),
});
});

test("list endpoint with term filter", async () => {
await caller.review.list({
options: {
term: "REMOTE",
},
});

expect(db.query.Review.findMany).toHaveBeenCalledWith({
orderBy: expect.anything(),
where: and(eq(Review.workEnvironment, "REMOTE")),
});
});

test("list endpoint with cycle and term filter", async () => {
await caller.review.list({
options: {
cycle: "SPRING",
term: "REMOTE",
},
});

expect(db.query.Review.findMany).toHaveBeenCalledWith({
orderBy: expect.anything(),
where: and(
eq(Review.workTerm, "SPRING"),
eq(Review.workEnvironment, "REMOTE"),
),
});
});
});

0 comments on commit 7373516

Please sign in to comment.