fix(jd-collect): 清缓存失败如实回 false,静默棘轮 blocks 按三支逐条登记
jd-category-cache.ts 的三支 try/catch(读/写/清)兜法都是把结果交给调用方,没有 console 糊过去;清缓存原先是空 catch(被 catch-silence-ratchet 判「新增静默 catch」),改成 return false 后静默数不动、只进 blocks 324→327。
This commit is contained in:
@@ -90,7 +90,7 @@ test('storage 不可用(隐私模式/配额)只影响缓存,不抛异常',
|
||||
assert.equal(saveCategoryCache(broken, {
|
||||
shopName: 'A', shopId: '', categories: [{ label: '其他', value: '1' }], fetchedAt: '',
|
||||
}), false)
|
||||
assert.doesNotThrow(() => clearCategoryCache(broken))
|
||||
assert.equal(clearCategoryCache(broken), false, '清不掉要如实回 false,不许吞成"清过了"')
|
||||
})
|
||||
|
||||
test('清缓存后读不到', () => {
|
||||
@@ -99,7 +99,7 @@ test('清缓存后读不到', () => {
|
||||
shopName: 'A', shopId: '', categories: [{ label: '其他', value: '1' }], fetchedAt: '',
|
||||
})
|
||||
assert.ok(loadCategoryCache(storage))
|
||||
clearCategoryCache(storage)
|
||||
assert.equal(clearCategoryCache(storage), true)
|
||||
assert.equal(loadCategoryCache(storage), null)
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user