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 从公开仓库中收录这些内容。

举报或申请下架