Skip to content

test(ratewise): 補離線靜態資源三層回退單元測試#478

Merged
s123104 merged 1 commit into
mainfrom
test/pwa-static-fallback-coverage
Jun 27, 2026
Merged

test(ratewise): 補離線靜態資源三層回退單元測試#478
s123104 merged 1 commit into
mainfrom
test/pwa-static-fallback-coverage

Conversation

@s123104

@s123104 s123104 commented Jun 27, 2026

Copy link
Copy Markdown
Contributor

Summary

新增測試

  1. 第一層 exactcaches.match(request) 命中即回傳,且不呼叫 matchPrecacheFn
  2. 第二層 ignoreSearch:exact miss 後以去掉 query 的 bareUrl 搭配 { ignoreSearch: true } 命中。
  3. 第三層 matchPrecache:前兩層 miss 後依 pathname 產生的 key(ratewise/assets/x.jsassets/x.jsx.js)呼叫 matchPrecacheFn 並回傳命中 Response。
  4. 全 miss:三層皆 miss 時回傳 Response.error()response.type === 'error')。

Test plan(本機 gate 證據)

  • pnpm --filter @app/ratewise exec vitest run pwaOfflineFallback — 9 passed
  • pnpm --filter @app/ratewise typecheck — 通過
  • pnpm lint — 通過

純測試新增,未修改 production code。

Made with Cursor

- 新增 resolveOfflineStaticResourceFallback 四項測試
- 覆蓋 exact、ignoreSearch、matchPrecache 與全 miss 回退
- 對齊 PR 452 未覆蓋的離線關鍵路徑

測試:pnpm --filter @app/ratewise exec vitest run pwaOfflineFallback、typecheck、lint

Co-authored-by: Cursor <cursoragent@cursor.com>
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

@github-actions

Copy link
Copy Markdown
Contributor

⚠️ Deprecation Warning: The deny-licenses option is deprecated for possible removal in the next major release. For more information, see issue 997.

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

Scanned Files

None

@s123104 s123104 merged commit e7c4e09 into main Jun 27, 2026
11 checks passed
@github-actions

Copy link
Copy Markdown
Contributor

✅ SEO 審計通過!所有 2026 標準驗證項目都符合要求。

  • ✅ Sitemap 2026 標準
  • ✅ Breadcrumb Schema
  • ✅ JSON-LD 結構化數據
  • ✅ 內部連結結構

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant