testing-standards

testing-standards is a cursor rule for Cursor from aaydin-tr/swagger-navigator-mcp. It costs 816 tokens per session, scanned A, original, MIT.

A set of project rules for writing and organizing tests in a TypeScript codebase using Jest, a JavaScript testing tool.

In plain words
What is it for?
Use it when adding unit tests, checking exported functions, testing environment-variable behavior, or mocking dependencies such as files and YAML data.
Why use it?
It gives contributors a consistent test layout, naming style, coverage expectations, and cleanup process. This reduces missed error cases and tests that affect one another.

Cursor rule for Cursor

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 rules/aaydin-tr/swagger-navigator-mcp/testing-standards
Clone the repo
git clone --depth 1 https://github.com/aaydin-tr/swagger-navigator-mcp

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 testing-standards

README.md
[![agentmods](https://agentmods.dev/badge/rules/aaydin-tr/swagger-navigator-mcp/testing-standards.svg)](https://agentmods.dev/rules/aaydin-tr/swagger-navigator-mcp/testing-standards)
Your own site
<a href="https://agentmods.dev/rules/aaydin-tr/swagger-navigator-mcp/testing-standards"><img src="https://agentmods.dev/badge/rules/aaydin-tr/swagger-navigator-mcp/testing-standards.svg" alt="Measured on agentmods" height="20"></a>
Per session 816 This file is loaded in full into every session.
When invoked 816 The same file — it is already loaded in full.
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.1 $0.00816 $0.00816
Opus 5 $0.00408 $0.00408
Sonnet 5 $0.00163 $0.00163
Haiku 4.5 $0.00082 $0.00082

Measured 5d ago against content hash 9373fd38b55d, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-05, from the pricing page.

Security

Grade A, and why

testing-standards 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 5d 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.

.cursor/rules/testing-standards.mdc · 132 lines

How it starts

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

Testing Standards

Test Structure

  • All tests should be placed in the tests/ directory, mirroring the src/ structure
  • Test files must use .test.ts extension
  • Use descriptive describe and it blocks that clearly explain what is being tested

Coverage Requirements

  • Aim for 100% code coverage on utility modules like env-substitution.ts
  • All exported functions must have comprehensive test coverage
  • Test both happy path and error scenarios

Test Organization

describe("moduleName", () => {
  const originalEnv = process.env;

  beforeEach(() => {
    jest.resetModules();
    jest.clearAllMocks();
    process.env = { ...originalEnv };
  });

  afterAll(() => {
    process.env = originalEnv;
  });

  describe("functionName", () => {
    it("should handle expected behavior", () => {
      // Test implementation
    });

    it("should handle error cases", () => {
      // Error test implementation
    });
  });
});

Mocking Guidelines

  • Mock external dependencies (fs, yaml, etc.) using Jest mocks
  • Use typed mocks: const mockFunction = fn as jest.MockedFunction<typeof fn>
  • Always restore original environment variables and mocks between tests
  • Test integration flows by mocking at appropriate boundaries

Required Test Types

  1. Unit Tests: Test individual functions in isolation
  2. Integration Tests: Test function interactions
  3. Error Handling: Test all error paths and edge cases
  4. Environment Variable Tests: Test env var substitution and validation
  5. Path Resolution Tests: Test relative/absolute path handling

Test Naming Conventions

  • Use descriptive test names that explain the scenario
  • Follow pattern: "should [expected behavior] when [condition]"
  • Group related tests using nested describe blocks

Testing Standards

Test Structure

  • All tests should be placed in the tests/ directory, mirroring the src/ structure
  • Test files must use .test.ts extension
  • Use descriptive describe and it blocks that clearly explain what is being tested

Read the full file on GitHub · 132 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. 5d ago First seen · 132 lines · 816 tokens per session scan A 9373fd38b55d

Subscribe to this mod's changes

testing-standards is a cursor rule published in the GitHub repository aaydin-tr/swagger-navigator-mcp (2 stars, last pushed 2mo ago), licensed MIT. It adds 816 tokens to every session, about $0.0041 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-31.