360 Secure SkillHub
360 安全技能中心

convex-test

该 Skill 指导使用 convex-test 与 vitest 针对内存后端编写 Convex 函数测试,覆盖参数与返回值、认证路径、索引和定时函数,并要求测试保持确定性。

convex
热度 0.00
最近更新 2026-10-18 16:51:34
分类:开发依赖:代码执行应用场景:代码生成

安装技能

复制下面的话术发给你的 Agent,它会通过 secure-skills 检索并安装该技能。

执行命令安装此 skill: npx secure-skills-cli add convex/agent-skills/convex-test
Metadata
name
convex-test
description
Generate convex-test tests for the app's Convex functions.

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).