跳到正文
TakoAPI
返回技能列表

fosmvvm-serverrequest-test-generator

由 foscomputerservices 提供

DevOps & Cloud
441下载量由 clawskills.sh 提供
2星标
0浏览量
0 个赞登录后即可为这个技能点赞
—暂无评分
你的评分

简介

Generate ServerRequest tests using VaporTesting.

描述

该技能的功能

Generates test files for ServerRequest types using VaporTesting infrastructure. Tests are built around typed request/response validation, covering Show, Create, Update, and Delete operations without manual URL construction or JSON encoding.

Using app.testing().test(request, locale:) instead of manual URL strings or URLSession keeps tests type-safe and path-derivation automatic.

何时使用

  • Testing a ShowRequest returns the correct ViewModel for a given ID
  • Verifying CreateRequest rejects empty input with a 400 status
  • Running the same request across English and Spanish locales
  • Confirming a DeleteRequest removes an entity and subsequent Show returns 404
  • Testing UpdateRequest reflects changed field values in the response body

示例工作流

输入

User asks: generate tests for IdeaShowRequest covering success and not-found cases

智能体
  1. 1

    Reads ServerRequest type from conversation context to identify query params and ResponseBody type

  2. 2

    Plans test scenarios: success path with valid ID, not-found path with invalid ID

  3. 3

    Generates IdeaRequestTests.swift with @Suite and two @Test functions

  4. 4

    Adds withTestApp helper that registers IdeaController and calls withApp

  5. 5

    Writes typed assertions on response.status and response.body using app.testing().test()

输出

Tests/WebServerTests/Requests/IdeaRequestTests.swift with showRequest_success and showRequest_notFound test methods

安装

clawhub install foscomputerservices/fosmvvm-serverrequest-test-generator

运行 CLI 命令,或把这段提示词粘贴到 Claude Code、Cursor、Codex 或你在用的任意编程智能体里。

链接