Load sharing and external-player tools on demand

This commit is contained in:
Jonathan Sykes
2026-10-08 04:44:35 +08:00
parent 94ea211605
commit 0475a1826c
7 changed files with 249 additions and 219 deletions

View File

@@ -57,3 +57,14 @@ test('watch-party facade keeps playback decisions synchronous before and after l
context.window.YT={Party:{guestActive:()=>true,intercept:action=>action==='next',nextDJ:()=>true}};
for(const method of ['guestActive','intercept','nextDJ'])assert.equal(context.api[method]('next'),true);
});
test('Share and External stay behind lazy entry proxies',()=>{
assert.match(app,/const Share = Lazy\.proxy\('feature:share-external'/);
assert.match(app,/const External = Lazy\.proxy\('feature:share-external'/);
const chunk=readFileSync(join(__dirname,'share-external.js'),'utf8');
const context=require('node:vm').createContext({window:{},navigator:{userAgent:''},location:{origin:'https://fixture.test'},isUploadId:()=>false});
require('node:vm').runInContext(chunk,context);
assert.equal(typeof context.window.YT.Share.open,'function');
const text=context.window.YT.External.m3u([{id:'benchmedia01',title:'Fixture'}]);
assert.match(text,/#EXTM3U/);assert.match(text,/benchmedia01/);
});