Convex Test

作者 get-convex2cfe645c87f9無授權條款63 個星標收錄於 2026年10月8日更新於 2026年10月8日儲存庫6 天前更新

Generate convex-test tests for the app's Convex functions.

AI 產生的概覽

為應用程式的 Convex 函式產生 convex-test 與 vitest 測試,涵蓋驗證、錯誤、索引與排程函式。

功能
此技能引導使用 convex-test 搭配 vitest,在記憶體後端上為 Convex 後端函式撰寫自動化測試。流程包含安裝相關工具、透過 t.run 寫入種子資料、呼叫 t.query 與 t.mutation,並對參數與回傳值進行斷言。同時涵蓋使用 withIdentity 的驗證路徑、錯誤路徑,以及透過 t.finishInProgressScheduledFunctions 處理的排程函式。最終產出的是以 vitest 執行的確定性測試套件。
適用情境
當 Convex 專案的查詢、變更與排程函式需要測試涵蓋時使用。適合測試應在記憶體中執行而非針對線上部署的情境,也適合需要在正常路徑之外驗證驗證與錯誤路徑的情況。
執行需求
需要一個 Convex 專案,並安裝 convex-test 與 vitest 套件。測試在記憶體後端執行,不需要線上部署或網路存取。此技能不含指令碼,僅為說明文件。
<!-- GENERATED from convex-agents content/capabilities/test.json — do not edit by hand. -->

Generate Convex tests

Use convex-test + vitest to test functions against an in-memory backend: args/returns, auth paths, indexes, and scheduled functions.

Workflow

  1. Install convex-test + vitest.
  2. Write tests using convexTest(schema): seed via t.run, call t.query/t.mutation, assert.
  3. Cover auth (withIdentity), error paths, and scheduled functions (t.finishInProgressScheduledFunctions).
  4. Run vitest; keep tests deterministic.

Rules

  • Use convex-test (in-memory), not a live deployment.
  • Cover auth + error paths, not just the happy path.
  • Keep tests deterministic (no real time/network).

來源與署名

來源:get-convex/agent-skills位於skills/convex-test提交2cfe645

授權條款: 無授權條款

內容歸原作者所有。SourceWeft 從公開儲存庫中收錄這些內容。

檢舉或申請下架