testing

Testing guidance for Ledger Wallet desktop and mobile applications using Jest, request mocks, and React testing libraries. Unit tests check one piece of behavior, while integration tests check several real pieces working together.

In plain words
What is it for?
Use it when writing or reviewing Jest tests, request handlers, UI queries, fixtures, feature-flag tests, and integration tests. It covers desktop and mobile testing but not full end-to-end tests.
Why use it?
It helps tests reflect what users can see and do instead of merely checking that hidden elements exist. It also avoids duplicate mocks and encourages reuse of existing test data.

Skill for Claude CodeCodex

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.

agentmods
npx agentmods add skills/ledgerhq/ledger-live/testing
Any agent
npx skills add LedgerHQ/ledger-live --skill testing
Clone the repo
git clone --depth 1 https://github.com/LedgerHQ/ledger-live

Made for: Claude Code, Codex.

Per session 66 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,696 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
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 $0.00066 $0.01696
Opus 5 $0.00033 $0.00848
Sonnet 5 $0.00013 $0.00339
Haiku 4.5 $0.00007 $0.00170

Measured 3d ago against content hash f6e7105accdb, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

testing 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 3d 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/SKILL.md · 198 lines

How it starts

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

Ledger Wallet Testing Skill

Jest + MSW + React Testing Library (Desktop) / React Native Testing Library (Mobile) ❌ E2E tests → Use e2e skill


Golden Rules

  1. toBeVisible() over toBeInTheDocument() — Always. toBeInTheDocument only checks DOM presence; elements can be hidden. Use toBeInTheDocument only when testing explicitly hidden elements.
  2. Search before you create — Before writing any mock, fixture, or helper, rg the codebase. If it exists, import it. If your new mock is reusable (2+ files), put it in a shared location.
  3. Mock external deps only — Never mock child components. Test integration.
  4. One behavior per test — Name: it("should <behavior> when <condition>").
  5. Query priority: getByRole > getByLabelText > getByText > getByTestId (last resort).
  6. Feature flags via store, never mocked — Use overriddenFeatureFlags in initialState.settings.
  7. Use existing factoriesgenAccount() from @ledgerhq/ledger-wallet-framework/mocks/account, getCryptoCurrencyById() from @ledgerhq/live-common/currencies. Never recreate account/currency data from scratch.

Quick Reference

pnpm test:jest "filename"    # Run specific file
pnpm test:jest               # Run all tests
pnpm test:jest --coverage    # Coverage report

# Coin modules (libs/coin-modules)
pnpm coin:<name> test              # Unit tests
pnpm coin:<name> test "filename"   # Specific file
pnpm coin:<name> test-integ        # Integration tests (slow)
Platform Render Import MSW Server
Desktop tests/testSetup tests/server.ts
Mobile @tests/test-renderer __tests__/server.ts

Test Template

import { render, screen, waitFor } from "tests/testSetup";
import { server } from "tests/server";
import { http, HttpResponse } from "msw";

jest.mock("@ledgerhq/live-common/someService");

describe("MyComponent", () => {
  beforeEach(() => jest.clearAllMocks());

  it("should render title", () => {
    render(<MyComponent title="Test" />);
    expect(screen.getByText("Test")).toBeVisible();
  });

  it("should call onClick when button pressed", async () => {
    const onClick = jest.fn();
    const { user } = render(<MyComponent onClick={onClick} />);
    await user.click(screen.getByRole("button"));
    expect(onClick).toHaveBeenCalledTimes(1);
  });

  it("should display fetched data", async () => {
    server.use(http.get("/api/data", () => HttpResponse.json({ name: "Bitcoin" })));
    render(<MyComponent />);
    await waitFor(() => expect(screen.getByText("Bitcoin")).toBeVisible());
  });
});

Read the full file on GitHub · 198 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. 3d ago First seen · 198 lines · 66 tokens per session scan A f6e7105accdb

Subscribe to this mod's changes

testing is a skill published in the GitHub repository LedgerHQ/ledger-live (614 stars, last pushed 3d ago), licensed MIT. It adds 66 tokens to every session and 1,696 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-08-30.