unit-tests
Use when writing or reviewing JavaScript/TypeScript unit tests with Vitest, for BDD structure, AAAR comments, and coverage/mocking conventions.
Skill by ioncache
Install
Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.
npx agentmarket install skill/ioncache-unit-tests
Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.
Get the weekly diff
The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.
About
Use cases: testing, writing
Reviews
Write a reviewNo reviews yet. Installed it? Reviews come from verified installers only. How reviews work
Permissions
What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.
- Tools
- No tools found
- Secrets
- None asked for
- Install scripts
- None found
Network hosts it talks to 1
codeload.github.com· found in install command
Files it touches
~/.claude/skills/unit-tests
What's inside
- Skill name
unit-tests- Description
- Use when writing or reviewing JavaScript/TypeScript unit tests with Vitest, for BDD structure, AAAR comments, and coverage/mocking conventions. Opinionated, assumes Vitest.
- License
- MIT
- Instructions
- 140 lines in SKILL.md · view on GitHub
Files (1)
- SKILL.md
SKILL.md (first lines)
# Unit Testing Standards (Vitest)
**Applies to:** JavaScript/TypeScript with Vitest.
## Core Principles
1. Use AAAR (Arrange, Act, Assert, Revert) comments for test clarity
2. Aim for 100% coverage; use `/* istanbul ignore next */` with justification
3. BDD format: `describe()` blocks + `it()` (NEVER use `test()`)
4. Test titles MUST start with `should` and describe behavior
5. Colocate tests with the source file they cover
## Test Structure
```javascript
import { describe, it, expect, beforeEach } from 'vitest'
import { functionToTest } from './moduleToTest'
describe('moduleToTest.js', () => {
describe('functionToTest', () => {
it('should do something specific when given certain input', () => {
// Arrange
const input = 'test'
// Act
const result = functionToTest(input)
// Assert
expect(result).toBe('expected')
})
})
})
```
## Coverage & Mocking
**Coverage:** Use `/* istanbul ignore next */` only when necessary (error
boundaries, third-party code, platform-specific, E2E-tested UI). Add a comment
explaining why.
**Mocking:** Avoid when possible. If needed, mock at the lowest level and
document why. Prefer refactoring for testability:
```javascript
// Before: requires mocking Date
function getCurrentTime() {
return new Date().toISOString()
}
// After: testable via dependency injection
function getCurrentTime(date = new Date()) {
return date.toISOString()
}
```
## Test Execution (MANDATORY)
**After ANY test file change** (new tests, edits, refactors), you MUST:
1. Run the modified test file
2. Fix failures
3. Repeat until green
Do not consider test changes complete until tests pass.
## BDD Format Requirements
- Use `describe()` for context and unit under test
- Use `it()` for test cases (NEVER use `test()`)
- Titles MUST start with `should` + observable behavior
- One behavior per test when possible
```javascript
describe('Calculator', () => {
describe('add', () => {
it('should return sum of two positive numbers', () => {})
it('should handle negative numbers correctly', () => {})
it('should throw error for non-numeric input', () => {})
})
})
```
## AAAR Comments
Use in every non-trivial test:
- `// Arrange`, setup/given
- `// Act`, when
- `// Assert`, then
- `// Revert`, cleanup (or use `afterEach`)
Simple tests with obvious steps may omit these.
## Example Test
```javascript
import { describe, it, expect, beforeEach } from 'vitest'
import { processRanges } from './labResults'
describe('labResults.js', () => {
describe('processRanges', () => {
let ranges, value, options
beforeEach(() => {
// Arrange
ranges = {
optimal: [[0, 10]],
warning: [[11, 20]],
danger: [[21, 30]]
}
value = 15
options = {}
})
it('should return correct range info for value in warning range', () => {
// Act
const result = processRanges(ranges, value, options)
// AssertFrom ioncache/ioncache-ai-tools, MIT.
More from ioncache/ioncache-ai-tools
- 0.565score
verify-unresolved-pr-comments
ioncache
Analyzes unresolved review comments and PR-level feedback on the active PR without making changes.
SkillAFreshness: AClaude Code +9 - 0.565score
investigate
ioncache
Traces how a feature, workflow, or system works without changing files.
SkillAFreshness: AClaude Code +9 - 0.565score
review-code
ioncache
Reviews code for correctness, security, performance, and project standards using independent review passes.
SkillAFreshness: AClaude Code +9 - 0.565score
review-validate-fix-loop
ioncache
Autonomously reviews, validates, fixes, and re-reviews code within finite nested loops, preserving decisions in a per-run ledger.
SkillAFreshness: AClaude Code +9 - 0.565score
triage-errors
ioncache
Groups and fixes errors by root cause after a large change.
SkillAFreshness: AClaude Code +9 - 0.559score
create-worktree
ioncache
Creates a git worktree and applies the repo's .worktree-setup.json.
SkillAFreshness: AClaude Code +9 - 0.524score
security
ioncache
Use when writing or reviewing API endpoints, database access, auth, or user input handling, for validation, sanitization, and secret-handling standards.
SkillBFreshness: BClaude Code +9 - 0.524score
jsdoc
ioncache
Use when writing or reviewing JSDoc on JavaScript/TypeScript functions, for required tags, typedef rules, and formatting.
SkillBFreshness: BClaude Code +9 - 0.524score
documentation-writing
ioncache
Use when writing or updating documentation, READMEs, commit messages, or code comments, for sentence style, punctuation, and emphasis rules.
SkillBFreshness: BClaude Code +9 - 0.524score
code-complexity
ioncache
Use when writing or reviewing functions, for guidance on parameter counts, nesting depth, function length, and single-responsibility structure.
SkillBFreshness: BClaude Code +9 - 0.521score
prompt-output
ioncache
Use whenever the task is to produce a prompt file (a .prompt.md file, or any "write me a prompt" request), for the required output format.
SkillBFreshness: BClaude Code +9 - 0.521score
answer-questions
ioncache
Invoke before responding whenever the user asks a direct question.
SkillBFreshness: BClaude Code +9
Signals
- Stars
- 0
- Forks
- 0
- Open issues
- 3
- Last commit (this folder)
- Jul 29, 2026 (3 months ago)
From GitHub (fetched Oct 24, 2026).
Details
- License
- MIT
- Repository
- github.com/ioncache/ioncache-ai-tools
- First seen
- Oct 24, 2026
- Last checked
- Oct 24, 2026
- Source
- GitHubgithub-graphql
More from ioncache
- 0.565score
triage-errors
ioncache
Groups and fixes errors by root cause after a large change.
SkillAFreshness: AClaude Code +9 - 0.565score
verify-unresolved-pr-comments
ioncache
Analyzes unresolved review comments and PR-level feedback on the active PR without making changes.
SkillAFreshness: AClaude Code +9 - 0.565score
review-validate-fix-loop
ioncache
Autonomously reviews, validates, fixes, and re-reviews code within finite nested loops, preserving decisions in a per-run ledger.
SkillAFreshness: AClaude Code +9 - 0.565score
investigate
ioncache
Traces how a feature, workflow, or system works without changing files.
SkillAFreshness: AClaude Code +9 - 0.565score
review-code
ioncache
Reviews code for correctness, security, performance, and project standards using independent review passes.
SkillAFreshness: AClaude Code +9 - 0.559score
create-worktree
ioncache
Creates a git worktree and applies the repo's .worktree-setup.json.
SkillAFreshness: AClaude Code +9
Cite this page
unit-tests skill. Agent Mart. https://agentmart.dev/skills/ioncache-unit-tests (last updated 2026-10-24)