test(ratewise): 補離線靜態資源三層回退單元測試#478
Merged
Merged
Conversation
- 新增 resolveOfflineStaticResourceFallback 四項測試 - 覆蓋 exact、ignoreSearch、matchPrecache 與全 miss 回退 - 對齊 PR 452 未覆蓋的離線關鍵路徑 測試:pnpm --filter @app/ratewise exec vitest run pwaOfflineFallback、typecheck、lint Co-authored-by: Cursor <cursoragent@cursor.com>
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Contributor
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.Scanned FilesNone |
Contributor
|
✅ SEO 審計通過!所有 2026 標準驗證項目都符合要求。
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
resolveOfflineStaticResourceFallback三層離線靜態資源回退,但pwaOfflineFallback.test.ts僅覆蓋resolveOfflineDocumentFallback,離線 JS/CSS 關鍵路徑缺測(對比 PR fix(ratewise): 移植導覽 case-3 有界網路 fallback 至 main #456 的 document fallback 測試完整性)。describe(resolveOfflineStaticResourceFallback),以vi.stubGlobal('caches', ...)mock 全域 Cache API,並以afterEach(vi.unstubAllGlobals)清理。新增測試
caches.match(request)命中即回傳,且不呼叫matchPrecacheFn。{ ignoreSearch: true }命中。ratewise/assets/x.js、assets/x.js、x.js)呼叫matchPrecacheFn並回傳命中 Response。Response.error()(response.type === 'error')。Test plan(本機 gate 證據)
pnpm --filter @app/ratewise exec vitest run pwaOfflineFallback— 9 passedpnpm --filter @app/ratewise typecheck— 通過pnpm lint— 通過純測試新增,未修改 production code。
Made with Cursor