import { EditorialExecutionService } from './editorial-execution'; describe('editorial expiry read/claim consistency',()=>{ it('rejects the actual expired claim while status explains blocked READY',async()=>{ jest.useFakeTimers().setSystemTime(new Date('2026-10-24T09:15:00Z')); const t={id:'565ace1f-8cfc-4447-b978-66c36e7b767b',state:'READY',version:4,metadata:{commitSha:'a'.repeat(40)}}; const tx:any={$queryRaw:jest.fn().mockResolvedValue([]),orchestrationApprovalDecision:{findFirst:jest.fn().mockResolvedValue({decision:'APPROVED',actorId:'owner',expiresAt:new Date('2026-10-24T06:37:00Z')})},orchestrationArtifact:{findMany:jest.fn().mockResolvedValue([])}}; const s=new EditorialExecutionService({$transaction:async(fn:any)=>fn(tx)} as any); jest.spyOn(s as any,'scope').mockResolvedValue(t); const a={id:'pmo',role:'WORKFLOW_WORKER'}; await expect(s.claim(a,{taskId:t.id})).rejects.toMatchObject({status:403,message:'Valid independent Gate1 required'}); await expect(s.status(a,t.id)).resolves.toMatchObject({state:'READY',version:4,displayState:'GATE1_RENEWAL_REQUIRED',gate1Validity:'BLOCKED',artifact:null}); jest.useRealTimers(); }); });