跳到正文
TakoAPI
返回技能列表

fosmvvm-viewmodel-test-generator

由 foscomputerservices 提供

Git & GitHub
302下载量由 clawskills.sh 提供
0浏览量
0 个赞登录后即可为这个技能点赞
—暂无评分
你的评分

简介

Generate ViewModel tests with codable round-trip, versioning stability, and multi-locale translation verification.

描述

该技能的功能

Generates Swift test files for FOSMVVM ViewModels, covering codable round-trip encoding, versioning stability, and multi-locale translation verification. Works from conversation context to determine ViewModel structure and localization requirements. Produces test suites and YAML translation files.

A single expectFullViewModelTests() call replaces writing separate codable, versioning, and localization tests by hand.

何时使用

  • Adding test coverage to a newly created ViewModel
  • Verifying all localized strings have translations in every supported locale
  • Testing nested ViewModel hierarchies with parent and child types
  • Checking that @LocalizedSubs substitution produces the correct output strings
  • Catching versioning regressions when a ViewModel structure changes

示例工作流

输入

User asks: generate tests for DashboardViewModel which has @LocalizedString pageTitle and emptyMessage

智能体
  1. 1

    Identifies ViewModels and their @LocalizedString properties from conversation context

  2. 2

    Determines YAML entries needed for each locale (en, es by default)

  3. 3

    Generates DashboardViewModelTests.swift conforming to LocalizableTestCase with expectFullViewModelTests call

  4. 4

    Generates DashboardViewModel.yml with en and es translations for pageTitle and emptyMessage

  5. 5

    Reports file locations under Tests/{Target}Tests/Localization/ and Tests/{Target}Tests/TestYAML/

输出

DashboardViewModelTests.swift and DashboardViewModel.yml ready to drop into the SPM test target

安装

clawhub install foscomputerservices/fosmvvm-viewmodel-test-generator

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

链接