docs(tests): clarify media fixtures and response timeout coverage

This commit is contained in:
2026-11-12 17:14:54 +08:00
parent 81055e14a1
commit 2dbe68c6aa
4 changed files with 14 additions and 5 deletions
+3 -1
View File
@@ -45,7 +45,8 @@ test("icon data rejects executable shapes, events and external paint references"
// 让 setImmediate 推进到调度任务阶段;用于观察尚未开始、排队及已释放容量的加载。
const tick = () => new Promise((resolve) => setImmediate(resolve));
// request 后立即 abort,尚未进入调度时不能启动网络加载,也不能把未完成值留入缓存。
// request 后立即 abort,尚未进入调度时不能调用加载函数,也不能把未完成值留入缓存。
// 测试名中的 unmounted 由 AbortController 模拟:没有挂载 React 图标,也没有发真实网络请求。
test("an immediately unmounted icon does not start a network request", async () => {
let calls = 0;
const loader = createResourceLoader(async () => { calls++; return "unused"; });
@@ -86,6 +87,7 @@ test("unused queued loads never start; a remaining subscriber keeps a shared loa
});
// active abort 后释放容量,失败 key 可重新加载;容量二的 LRU 在加入 a/b 后淘汰更早 fail,保留仍在缓存的 a。
// abort 替身监听内部 signal 后拒绝;fail 替身只失败一次,区分“取消后可继续调度”和“失败未永久缓存”。
test("active aborts and failed requests can retry; least recently used cache is bounded", async () => {
let fail = true;
const loader = createResourceLoader(async (key, signal) => {