squid-main-space / tests /test_download_opfs_fallback_v459.py
Zin299's picture
Deploy v4.6.15 product finish system health
1d46957
Raw
History Blame Contribute Delete
1.05 kB
from pathlib import Path
ROOT=Path(__file__).resolve().parents[1]
def test_version():
assert (ROOT/"VERSION").read_text(encoding="utf-8").strip()=="4.6.15"
def test_opfs_is_probed_not_assumed():
js=(ROOT/"static"/"js"/"app.js").read_text(encoding="utf-8")
assert "async function probeOpfsWritable" in js
assert 'getFileHandle("__probe__.tmp"' in js
assert "OPFS_CAPABILITY=false" in js
def test_opfs_failure_falls_back_without_counting_file_failed():
js=(ROOT/"static"/"js"/"app.js").read_text(encoding="utf-8")
assert "function isOpfsUnavailableError" in js
assert "streamManagedDownloadFallback" in js
assert "不会把兼容性问题记为文件失败" in js
def test_main_and_retry_paths_use_probe():
js=(ROOT/"static"/"js"/"app.js").read_text(encoding="utf-8")
assert js.count("if(await probeOpfsWritable())") >= 2
def test_real_transport_failure_is_explained():
js=(ROOT/"static"/"js"/"app.js").read_text(encoding="utf-8")
assert "当前文件在实际传输阶段重试后仍失败" in js