jest

jest is a skill for Claude Code, Codex from Plazmodium/odin-workflow. It costs 51 tokens per session (1,224 once invoked), scanned A, original, MIT.

A guide to Jest, a JavaScript and TypeScript testing framework for checking individual pieces of code and groups of components working together. It covers test structure, mocks, assertions, snapshots, coverage, and continuous integration.

In plain words
What is it for?
Use it to write unit and integration tests, mock dependencies, test React or Node.js code, check coverage, and run tests in automated build systems.
Why use it?
It gives developers a consistent way to test normal results, errors, boundary cases, and asynchronous code before changes are shipped.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one. Also seen: positional $N argument.

Good fit Use it to write unit and integration tests, mock dependencies, test React or Node.js code, check coverage, and run tests in automated build systems.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/plazmodium/odin-workflow/jest
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add Plazmodium/odin-workflow --skill jest
Clone the repo
git clone --depth 1 https://github.com/Plazmodium/odin-workflow

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for jest

README.md
[![agentmods](https://agentmods.dev/badge/skills/plazmodium/odin-workflow/jest.svg)](https://agentmods.dev/skills/plazmodium/odin-workflow/jest)
Your own site
<a href="https://agentmods.dev/skills/plazmodium/odin-workflow/jest"><img src="https://agentmods.dev/badge/skills/plazmodium/odin-workflow/jest.svg" alt="Measured on agentmods" height="20"></a>
Per session 51 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,224 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00051 $0.01224
Opus 5 $0.00026 $0.00612
Sonnet 5 $0.00010 $0.00245
Haiku 4.5 $0.00005 $0.00122

Measured 6d ago against content hash 908e994567f5, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-07, from the pricing page.

Security

Grade A, and why

jest scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 6d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

agents/skills/testing/jest/SKILL.md · 177 lines

How it starts

The opening of the file, as written. The whole thing — 177 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Jest Testing Framework

Instructions

  1. Assess the testing need: Determine if it's unit tests, integration tests, or snapshot tests.
  2. Follow Jest conventions:
    • Test files: *.test.ts, *.spec.ts, or in __tests__/ directory
    • Use describe blocks to group related tests
    • Use it or test for individual test cases
    • Use beforeEach/afterEach for setup/teardown
  3. Provide complete examples: Include imports, mocks, and assertions.
  4. Guide on mocking: Explain jest.mock(), jest.fn(), and jest.spyOn().
  5. Cover edge cases: Test error conditions, boundary values, and async behavior.

Test Structure

import { describe, it, expect, beforeEach, jest } from '@jest/globals';
import { myFunction } from './myModule';

describe('myFunction', () => {
  beforeEach(() => {
    jest.clearAllMocks();
  });

  it('should return expected value for valid input', () => {
    const result = myFunction('valid');
    expect(result).toBe('expected');
  });

  it('should throw error for invalid input', () => {
    expect(() => myFunction(null)).toThrow('Invalid input');
  });

  it('should handle async operations', async () => {
    const result = await myFunction('async');
    expect(result).resolves.toBe('done');
  });
});

Mocking Patterns

Mock a module

jest.mock('./database', () => ({
  query: jest.fn().mockResolvedValue([{ id: 1 }]),
}));

Mock a function

const mockCallback = jest.fn((x) => x + 1);
expect(mockCallback(1)).toBe(2);
expect(mockCallback).toHaveBeenCalledWith(1);

Spy on methods

const spy = jest.spyOn(object, 'method');
object.method();
expect(spy).toHaveBeenCalled();
spy.mockRestore();

Mock timers

jest.useFakeTimers();
setTimeout(callback, 1000);
jest.advanceTimersByTime(1000);
expect(callback).toHaveBeenCalled();

Common Assertions

// Equality
expect(value).toBe(exact);           // Strict equality
expect(value).toEqual(object);       // Deep equality
expect(value).toStrictEqual(object); // Deep + type equality

// Truthiness
expect(value).toBeTruthy();
expect(value).toBeFalsy();
expect(value).toBeNull();
expect(value).toBeUndefined();
expect(value).toBeDefined();

// Numbers
expect(value).toBeGreaterThan(3);
expect(value).toBeLessThanOrEqual(5);
expect(value).toBeCloseTo(0.3, 5);   // Floating point

// Strings
expect(string).toMatch(/pattern/);
expect(string).toContain('substring');

// Arrays
expect(array).toContain(item);
expect(array).toHaveLength(3);

// Objects
expect(object).toHaveProperty('key', 'value');
expect(object).toMatchObject({ partial: 'match' });

// Errors
expect(() => fn()).toThrow();
expect(() => fn()).toThrow('message');
expect(() => fn()).toThrow(ErrorClass);

// Async
await expect(promise).resolves.toBe(value);
await expect(promise).rejects.toThrow();

Read the full file on GitHub · 177 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 6d ago First seen · 177 lines · 51 tokens per session scan A 908e994567f5

Subscribe to this mod's changes

jest is a skill published in the GitHub repository Plazmodium/odin-workflow (0 stars, last pushed 3mo ago), licensed MIT. It adds 51 tokens to every session and 1,224 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-01.

Related

Other skills, from other repositories

api-testing

Testing patterns for MCP tool/resource handlers using createMockContext and Vitest. Covers mock context options, handler testing, McpError assertions, format testing, Vitest config setup, and test isolation conventions.

cyanheads/pubmed-mcp-server · 46 tokens

api-testing

Testing patterns for MCP tool/resource handlers using createMockContext and Vitest. Covers mock context options, handler testing, McpError assertions, format testing, Vitest config setup, and test isolation conventions.

cyanheads/sports-mcp-server · 46 tokens

api-testing

Testing patterns for MCP tool/resource handlers using createMockContext and Vitest. Covers mock context options, handler testing, McpError assertions, format testing, Vitest config setup, and test isolation conventions.

cyanheads/internet-archive-mcp-server · 46 tokens

api-testing

Testing patterns for MCP tool/resource handlers using createMockContext and Vitest. Covers mock context options, handler testing, McpError assertions, format testing, Vitest config setup, and test isolation conventions.

cyanheads/smithsonian-mcp-server · 46 tokens

api-testing

Testing patterns for MCP tool/resource handlers using createMockContext and Vitest. Covers mock context options, handler testing, McpError assertions, format testing, Vitest config setup, and test isolation conventions.

cyanheads/stackexchange-mcp-server · 46 tokens

add-test

Scaffold a test file for an existing tool, resource, or service. Use when the user asks to add tests, improve coverage, or when a definition exists without a matching test file.

cyanheads/stackexchange-mcp-server · 41 tokens