Test

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

Generate tests for Convex functions with convex-test (queries/mutations/auth/scheduling, in-memory). TRIGGER when the user wants tests / a test suite for their Convex backend / 'how do I test this'.

AI 產生的概覽

使用記憶體版 convex-test 函式庫為 Convex 後端函式產生 vitest 測試套件。

功能
引導代理使用 convex-test 與 vitest,針對記憶體後端為 Convex 查詢與變更撰寫測試。涵蓋透過 t.run 植入資料、呼叫 t.query 與 t.mutation、斷言參數與回傳值、使用 withIdentity 測試驗證路徑、錯誤路徑、索引,以及透過 t.finishInProgressScheduledFunctions 測試排程函式。產出可重現的測試檔案以及執行 vitest 的說明。
適用情境
當使用者需要為 Convex 後端撰寫測試或測試套件,或詢問如何測試 Convex 函式時使用。適用於已採用 Convex 與 vitest、需要涵蓋驗證、錯誤與排程行為的專案。
執行需求
需要安裝 convex-test 與 vitest 套件,並具備含 schema 的 Convex 專案。此技能不附帶指令碼,僅為說明文件。測試應在記憶體中執行,不需要實際部署、真實時間或網路存取。

Generate Convex tests

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

Steps

  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/convex-backend-skill位於skills/test提交6ca54f6

授權條款: 無授權條款

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

檢舉或申請下架