跳到正文
Skillpedia
测试9.5k · #12260

convex-test

它能做什么

这项技能为 Convex 应用中的函数编写测试。适合希望在用户发现问题之前就找出错误的开发者。

适用场景

  • ✓当你已经编写了 Convex 函数,并想为其编写测试时。
  • ✓当你想检查登录规则是否能拦住不该进入的人时。
  • ✓当你添加了定时任务,并想确认它们按预期运行时。

技能链接

https://github.com/openclaw/clawhub/blob/main/.agents/skills/convex-test/SKILL.md

复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。

使用方法

最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/openclaw/clawhub/blob/main/.agents/skills/convex-test/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 AI

“请为我的 Convex 函数编写自动化测试,包括用户未登录的情况。”

每周 5 个新技能,1 分钟读完。

工作原理

智能体会安装测试工具,编写在内存中模拟 Convex 后端运行的测试,填入示例数据,然后调用你的函数检查结果。

技术内容(原始 SKILL.md)

作者在 GitHub 上的英文原文。

<!-- 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).
常见问题

测试会使用我的真实数据库吗?

不会。测试在内存中的副本上运行,而不是在真实部署上运行。

测试只检查正常情况吗?

不是。这项技能同时涵盖登录和错误路径,而不只是正常使用。

测试结果可以重复吗?

可以。这项技能使测试具有确定性,不依赖真实时钟或网络。

详情

作者的原始描述

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

repo: openclaw/clawhub

热度

GitHub 星标
9.5k
排名
#12260
许可证
MIT
更新时间
2026/11/2

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能