import {describe,it,expect} from "vitest"; import {EditorService} from "../src/media/editor-service.js"; import {CmsConnection} from "../src/cms/cms-connection.js"; describe("editor job boundary",()=>{ it("requires CMS login before preparing media and rejects unknown jobs",async()=>{ const service=new EditorService({cms:new CmsConnection({publishableKey:""}),runtimeRoot:"/unused/editor-tests",sessionId:"ses_test"}); await expect(service.prepare({dramaId:"06aa396d-175a-48ed-ad76-02786ef4d0a9",episodeNumbers:[1,3,5]},new AbortController().signal)).rejects.toMatchObject({code:"CMS_LOGIN_REQUIRED"}); expect(()=>service.status("job_unknown")).toThrow(); await expect(service.submitAnalysis("job_unknown",{},new AbortController().signal)).rejects.toMatchObject({code:"EDITOR_JOB_NOT_FOUND"}); expect(()=>service.workflowView("job_unknown")).toThrow(); await expect(service.review("job_unknown","selection",{})).rejects.toMatchObject({code:"EDITOR_JOB_NOT_FOUND"}); }); it("rejects duplicate episode requests and oversized preparation scope before fetching",async()=>{ const service=new EditorService({cms:new CmsConnection({publishableKey:""}),runtimeRoot:"/unused/editor-tests",sessionId:"ses_test"}); for(const numbers of [[1,1],[1,2,3,4,5,6],[]])await expect(service.prepare({dramaId:"06aa396d-175a-48ed-ad76-02786ef4d0a9",episodeNumbers:numbers},new AbortController().signal)).rejects.toThrow(); }); });