Skip to content
Development
Agent

aaa-and-naming

A good test reads like a specification. Two habits get you most of the way: a consistent three-phase body (AAA) and a name that states the behavior, not the method.

From plugin
vanara-agents-skills
954 skills54 agents

Claude Code

$ npx -y skills add vanara-agents/skills --agent claude-code

Agent definition

aaa-and-naming.md

Arrange-Act-Assert and Test Naming

A good test reads like a specification. Two habits get you most of the way: a consistent three-phase body (AAA) and a name that states the behavior, not the method.

Arrange-Act-Assert (AAA)

Structure every test in three visually separated phases:

it('caps the cart total at the configured maximum', () => {
  // Arrange — set up inputs, fixtures, doubles
  const cart = makeCart({ items: 5, unitPrice: 100 });
  const maxTotal = 400;

  // Act — invoke exactly ONE behavior
  const total = cart.totalWithCap(maxTotal);

  // Assert — verify the observable outcome
  expect(total).toBe(400);
});

Why it works:

  • **One Act per test.** If you need two actions, you probably have two tests. A single Act

keeps failures unambiguous — you know exactly what broke.

  • **Assertions only in Assert.** An assertion buried in Arrange hides setup failures as

behavior failures.

  • **No logic in tests.** Loops, conditionals, and try/catch in a test are a smell; they can

hide bugs in the test itself. Prefer table-driven cases or parameterized tests instead.

Given-When-Then

The same shape, phrased for behavior-driven tests: *Given* a context, *When* an action occurs, *Then* an outcome is observed. Map Given→Arrange, When→Act, Then→Assert.

Naming tests

A test name should let a reader understand the requirement **without reading the body**. State the scenario and the expected outcome.

**Weak (restates the method):**

test('applyDiscount')
test('test refund')
test('works')

**Strong (states the behavior):**

test('subtracts a percentage discount and rounds to two decimals')
test('throws RangeError when the discount exceeds 100 percent')
test('returns empty array when no markets match the query')
test('falls back to substring search when Redis is unavailable')

A useful template: **`<does X> when <condition Y>`** or **`<verb> <expected> given <state>`**.

One behavior per test

When a test fails, its name plus its single Act should tell you what's broken without debugging. Resist the "mega test" that arranges a huge world and asserts twenty things — the first failure masks the rest, and the name can't describe what it covers. Split by behavior.

Multiple assertions are fine — if they describe one behavior

// OK: these three assertions all describe "creates an open order"
expect(order.id).toBeDefined();
expect(order.status).toBe('open');
expect(order.createdAt).toBeInstanceOf(Date);

The guideline is *one logical concept per test*, not literally one `expect`.

Read more
@vanara-agents
Ships withvanara-agents-skills

🐒 Free agents, skills & packs for Claude Code One subscription. An army of Claude Code agents. 30 production-grade agents, skills, and packs for Claude Code — free, Apache-2.0, install with one command.

917 skills54 agents
Get the whole plugin

Stars on GitHub

Momentum

stars in total
9
Star history of vanara-agents/skills on GitHub, a chart by star-history.com

Other agents on vanara-agents-skills.

AGENT

AGENT

Agent

Use when designing a new HTTP/GraphQL API or changing an existing one — modeling resources, defining endpoint contracts, choosing…

More agents from other plugins.

a11y-architect
Auto-invoked

a11y-architect

Agent

Accessibility Architect specializing in WCAG 2.2 compliance for Web and Native platforms. Use PROACTIVELY when designing UI…

ecc12d293k
@affaan-m@affaan-mInstall Agent
analyze-pass-impact

analyze-pass-impact

Agent

Analyzes how a specific topic affects a group of compiler passes. Used by the /plan-update skill to parallelize research across…

react1d252k
@facebook@facebookInstall Agent
orchestrator

orchestrator

Agent

- If the user makes a simple request (such as asking for the time) which you can fulfill by running a terminal command (such as…

codextoday135k
@openai@openaiInstall Agent
cavecrew-builder

cavecrew-builder

Agent

Surgical 1-2 file edit. Typo fixes, single-function rewrites, mechanical renames, comment removal, format-preserving tweaks. Hard…

caveman2d119k
@juliusbrussee@juliusbrusseeInstall Agent

Questions about aaa-and-naming.

Which coding agents can use aaa-and-naming?
aaa-and-naming installs in Claude Code and Cursor: each loads subagents from .claude/agents, so copy the file there. Flowy's auto-invocation runs in Claude Code only.