Skip to content

Commit e18fbf8

Browse files
committed
test: guard empty-stream metadata lifecycle
1 parent 0e6d4ac commit e18fbf8

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

tests/global_stream_presentation_test.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,17 @@ def run(source: str, fetch_impl: str, call: str) -> object:
7373
assert token in row["description"], (token, row)
7474
assert "Unknown" not in row["description"]
7575

76+
# Empty provider output must not start an optional TMDB request that can outlive
77+
# the provider route and make native evidence look incomplete.
78+
empty = "module.exports={getStreams:async()=>[]};\n"
79+
empty_patched = presentation.apply(empty, context={"provider_id": "movieshunt"})
80+
empty_result = run(
81+
empty_patched,
82+
"async function(){global.__tmdbCalls=(global.__tmdbCalls||0)+1;throw new Error('must not run')}",
83+
"p.getStreams({tmdbId:'1233413',mediaType:'movie',title:'Sinners',year:2025}).then(v=>console.log(JSON.stringify({streams:v,calls:global.__tmdbCalls||0})))",
84+
)
85+
assert empty_result == {"streams": [], "calls": 0}, empty_result
86+
7687
# Resolution alone never invents Blu-ray provenance.
7788
plain = "module.exports={getStreams:async()=>[{name:'Cineby',url:'https://media.example/video.mp4',quality:'1080p'}]};\n"
7889
plain_patched = presentation.apply(plain, context={"provider_id": "cineby"})

0 commit comments

Comments
 (0)