test(api): pin the pagination tiebreaker in the two route tests

Both asserted the single-column `orderBy` the offset lists used to build,
so they held the defect in place: a test that pins the shape a fix has to
change is not evidence, it is a lock. Turned round to assert the total
order, with the reason at the call site.
This commit is contained in:
Marc-André Bombeck committed 2026-09-10 04:17:45 +02:00
1 parent 4993352cc9
commit a7bdf14a4e
2 files changed
+9 -3

No files matched your search

@@ -105,7 +105,10 @@ describe("GET /api/illness/episodes/{id}/day-logs — date-less list", () => {
const findArgs = vi.mocked(prisma.illnessDayLog.findMany).mock.calls[0][0];
expect(findArgs).toMatchObject({
where: { episodeId: "ep-1", deletedAt: null },
orderBy: { date: "desc" },
// `date` is a calendar day and repeats within an episode, so the
// unique tiebreaker is what keeps `skip`-based paging from repeating
// one row and dropping another between pages.
orderBy: [{ date: "desc" }, { id: "desc" }],
take: 60,
skip: 0,
});
@@ -126,7 +129,7 @@ describe("GET /api/illness/episodes/{id}/day-logs — date-less list", () => {
const findArgs = vi.mocked(prisma.illnessDayLog.findMany).mock.calls[0][0];
expect(findArgs).toMatchObject({
orderBy: { date: "asc" },
orderBy: [{ date: "asc" }, { id: "asc" }],
take: 10,
skip: 20,
});