myscript/iinkts/write-unit-test

Claude Code and agent skill by myscript/iinkts

Trust tier 2
  • community
LLM review pending
Source check pending

Checking that the SKILL.md file is still in the repository.

Workflow for adding Jest unit tests to iinkTS. Use when creating tests for new or existing src/ files. Complements the `testing-patterns` skill (patterns reference). This skill covers the workflow; the `testing-patterns` skill covers the API reference.

Install

npx vskill@latest install myscript/iinkts/write-unit-test

SKILL.md

Write Unit Test

Workflow

1. Find the mirror path

Test file = test/unit/ + same path as src/:

src/manager/interactive/IIWriterManager.ts
→ test/unit/manager/interactive/IIWriterManager.test.ts

If the test file doesn't exist yet, create it. Never put tests elsewhere.

2. Load the patterns reference

Before writing, invoke the testing-patterns skill for:

  • Mock setup (Canvas, WebSocket, fetch)
  • Standard describe/it structure
  • Available mocks: createCanvasMock/asCanvas, InteractiveInkSSRCanvasMock, CanvasEventMock, ServerWebSocketMock, etc.
3. Structure the test file
typescript
import { describe, test, expect, beforeEach, jest } from "@jest/globals"
import { ClassOrFunction } from "@/path/to/module"
describe("ClassName", () => {
describe("methodName", () => {
test("should [expected] when [condition]", () => {
// Arrange
// Act
// Assert
})
})
})
4. Cover minimum cases per function

For every public function/method:

  • ✅ Nominal — valid input, expected output
  • ✅ Error — invalid/null/undefined input
  • ✅ Edge — empty array, zero, boundary values
  • ✅ Side effects — if the function mutates state or emits events
5. Coverage check
bash
yarn test:unit --coverage --testPathPatterns="YourFile"

Target: ≥80% branches, functions, lines for new files.

Full suite check before commit:

bash
yarn test:unit

Quick Rules

  • No `any` in tests — type your mocks explicitly
  • No implementation details — test behavior, not internals
  • Isolate — each test should pass independently (no shared mutable state between tests)
  • Mock at boundaries — mock Canvas, WebSocket, fetch. Never mock the class under test itself.
  • One assertion focus per test — multiple expect OK if they describe one behavior

See Also

The testing-patterns skill — full mock API reference, WebSocket patterns, Playwright E2E patterns.

Security

  • Security scanPassed, 100 of 100Pattern checks on the skill's files.
  • Model reviewNot runA model review is scheduled for the next rescan.

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

Repository stars
99
Repository forks
16
7-day trend score
0

Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.

Works with

Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.

  • Claude Code
  • Cursor
  • GitHub Copilot
  • Windsurf
  • Codex
  • Gemini CLI
  • Cline
  • Amp
  • Roo Code
  • Goose
  • Continue
  • Kilo Code
  • Junie
  • Trae
  • OpenHands
  • Qwen Code
  • AI Agent
  • Tabnine Chat
  • Sourcegraph Cody
  • Amazon Q
  • Firebase Genkit
  • Sweep
  • Devin
  • Phind
  • Mentat
  • Claude Desktop
  • Aider
  • GPT Pilot
  • Plandex
  • bolt.new
  • v0
  • Replit Agent
  • Anse
  • TypingMind
  • BetterChatGPT
  • LibreChat
  • Warp AI
  • Pieces
  • Fig AI
Embed badge
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/myscript/iinkts/write-unit-test/badge)](https://verified-skill.com/skills/myscript/iinkts/write-unit-test)

Something wrong with this skill or its page? Tell us.