test(pause-api): harden "reject in-flight" test with durability assertion

Strengthen test to prove the job's paused state remains unmodified when
pause/unpause is rejected for a downloading job. Tests now seeds paused=true,
attempts paused=false, verifies 400, and fetches from DB to assert paused is
still true — catching regressions that would mutate before the guard check.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Jonathan
2026-07-15 12:18:03 +02:00
parent b78867435a
commit ecec0b6073
@@ -35,9 +35,11 @@ describe("per-item pause API", () => {
});
it("rejects pausing an in-flight job", async () => {
const created = await seed({ state: "downloading" });
const res = await POST(req(created.id, true), { params: Promise.resolve({ id: created.id }) });
const created = await seed({ state: "downloading", paused: true });
const res = await POST(req(created.id, false), { params: Promise.resolve({ id: created.id }) });
expect(res.status).toBe(400);
const job = await prisma.job.findUnique({ where: { id: created.job!.id } });
expect(job?.paused).toBe(true);
});
it("404s for a missing request", async () => {