import test from 'node:test';import assert from 'node:assert/strict';import {Broadcast} from '../src/player'; test('Play after a completed broadcast restarts the full show; pause resumes its section',async()=>{ let jumped=-1,played=0;const segments=[{duration:5,audio:{url:'/first.mp3'}},{duration:3,audio:{url:'/last.mp3'}}];const original=(globalThis as any).location;(globalThis as any).location={origin:'https://example.test'}; const player:any={episode:{segments},index:1,time:3,silent:false,muted:false,sound:{async start(){}},audio:{src:'',currentTime:0,async play(){played++;}},get segment(){return segments[this.index];},async jump(i:number){jumped=i;this.index=i;this.time=0;},onChange(){},onError(message:string){throw Error(message);}}; try{await Broadcast.prototype.play.call(player);assert.equal(jumped,0);assert.equal(player.audio.src,'https://example.test/first.mp3');assert.equal(played,1);jumped=-1;player.index=1;player.time=1;await Broadcast.prototype.play.call(player);assert.equal(jumped,-1);assert.equal(player.audio.currentTime,1);}finally{(globalThis as any).location=original;} });