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:
@@ -35,9 +35,11 @@ describe("per-item pause API", () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it("rejects pausing an in-flight job", async () => {
|
it("rejects pausing an in-flight job", async () => {
|
||||||
const created = await seed({ state: "downloading" });
|
const created = await seed({ state: "downloading", paused: true });
|
||||||
const res = await POST(req(created.id, true), { params: Promise.resolve({ id: created.id }) });
|
const res = await POST(req(created.id, false), { params: Promise.resolve({ id: created.id }) });
|
||||||
expect(res.status).toBe(400);
|
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 () => {
|
it("404s for a missing request", async () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user