返回 Skills 目录
get-convex/agent-skills已通过检查

SKILL DETAIL

convex-test

get-convex/agent-skills/convex-test

该技能指导如何使用 convex-test 和 vitest 为应用的 Convex 函数编写测试。它支持针对内存后端进行测试,涵盖参数和返回值、认证路径、索引以及计划函数。工作流程包括安装 convex-test 和 vitest,使用 convexTest(schema) 编写测试,通过 t.run 进行种子数据设置,调用 t.query/t.mutation 并断言结果,同时覆盖认证(withIdentity)、错误路径和计划函数(t.finishInProgressScheduledFunctions)。测试应保持确定性,避免使用真实时间或网络。

安装量 · 446查看来源

Installation

npx skills add https://github.com/get-convex/agent-skills --skill convex-test

技能文件

SKILL.md

最近同步 · 2026年10月15日

SKILL.md›
---
name: convex-test
description: "Generate convex-test tests for the app's Convex functions."
---

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