unit-test-manners

unit-test-manners is a cursor rule for Cursor from yu-iskw/llmops-demo-ts. It costs 326 tokens per session, scanned A, original, Apache-2.0.

A set of rules for writing unit tests, which test small pieces of code separately from the rest of an application. It recommends decoupling business logic from network, database, and file-system operations.

In plain words
What is it for?
Use it when designing code and unit tests, especially around external services, to separate pure logic from infrastructure work.
Why use it?
It aims to make tests less brittle and more representative by avoiding excessive mocks and keeping testable code focused on clear inputs and outputs.

Cursor rule for Cursor

Written for Cursor: installed under .cursor/.

Good fit Use it when designing code and unit tests, especially around external services, to separate pure logic from infrastructure work.

Compare 6 cursor rules from other repositories ↓
Install with agentmods
npx agentmods add rules/yu-iskw/llmops-demo-ts/unit-test-manners
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.

Clone the repo
git clone --depth 1 https://github.com/yu-iskw/llmops-demo-ts

Made for: Cursor.

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 unit-test-manners

README.md
[![agentmods](https://agentmods.dev/badge/rules/yu-iskw/llmops-demo-ts/unit-test-manners/github.svg)](https://agentmods.dev/rules/yu-iskw/llmops-demo-ts/unit-test-manners)
Your own site
<a href="https://agentmods.dev/rules/yu-iskw/llmops-demo-ts/unit-test-manners"><img src="https://agentmods.dev/badge/rules/yu-iskw/llmops-demo-ts/unit-test-manners/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for unit-test-manners

Your own site · 80×15
<a href="https://agentmods.dev/rules/yu-iskw/llmops-demo-ts/unit-test-manners"><img src="https://agentmods.dev/badge/rules/yu-iskw/llmops-demo-ts/unit-test-manners.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 326 This file is loaded in full into every session.
When invoked 326 The same file — it is already loaded in full.
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.00326 $0.00326
Opus 5 $0.00163 $0.00163
Sonnet 5 $0.00065 $0.00065
Haiku 4.5 $0.00033 $0.00033

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

Security

Grade A, and why

unit-test-manners 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 4d 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.

Origin

Copies of this mod

1 near-identical copy found in the catalogue:

.cursor/rules/unit-test-manners.mdc · 19 lines

What it actually says

Unit Test Manners: Decoupling for Testability

When implementing unit tests, adhere to the following principles to ensure robust, maintainable, and fast tests:

  1. Avoid Mocks and Patches for External Dependencies:

    • Do not rely on mocks or patches, especially for methods or functions that involve external interactions such as network requests, database calls, or file system operations.
    • Such tests often become brittle, difficult to maintain, and can give a false sense of security, as they test the interaction with a mocked dependency rather than the actual behavior of the system under test when integrated with real dependencies.
  2. Decouple Methods and Functions:

    • Design your methods and functions to be as decoupled as possible from external dependencies.
    • Focus on creating "pure" functions or components with clear inputs and deterministic outputs, allowing them to be tested in isolation without the need for network requests or other I/O operations.
    • Consider patterns such as "functional core, imperative shell" or "Hexagonal Architecture" to separate business logic from infrastructure concerns.
    • For infrastructure components that still require testing, explore techniques like "Nullables" where production code includes an "off" switch for dependencies or mechanisms to track output for state-based assertions, as discussed in "Testing Without Mocks: A Pattern Language" by James Shore [https://www.jamesshore.com/v2/blog/2018/testing-without-mocks].

By following these guidelines, you can write unit tests that are reliable, fast, and accurately reflect the behavior of your code.

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. 4d ago First seen · 19 lines · 326 tokens per session scan A bf4e49bc7cec

Subscribe to this mod's changes

unit-test-manners is a cursor rule published in the GitHub repository yu-iskw/llmops-demo-ts (6 stars, last pushed 7d ago), licensed Apache-2.0. It adds 326 tokens to every session, about $0.0016 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-04.