testing

testing is a cursor rule for Cursor from EvilFreelancer/openapi-to-cli. It costs 579 tokens per session, scanned A, original, MIT.

A set of Jest testing rules for the openapi-to-cli project. Jest is a tool that runs automated JavaScript and TypeScript tests.

In plain words
What is it for?
Use it when adding or editing tests, especially tests for modules that turn OpenAPI or Swagger documents into command-line tools.
Why use it?
It keeps tests arranged and written consistently, making failures easier to understand and reducing accidental changes to shared test data.

Cursor rule for Cursor

Written for Cursor: installed under .cursor/.

Good fit Use it when adding or editing tests, especially tests for modules that turn OpenAPI or Swagger documents into command-line tools.

Compare 6 cursor rules from other repositories ↓
Install with agentmods
npx agentmods add rules/evilfreelancer/openapi-to-cli/testing
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/EvilFreelancer/openapi-to-cli

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

README.md
[![agentmods](https://agentmods.dev/badge/rules/evilfreelancer/openapi-to-cli/testing/github.svg)](https://agentmods.dev/rules/evilfreelancer/openapi-to-cli/testing)
Your own site
<a href="https://agentmods.dev/rules/evilfreelancer/openapi-to-cli/testing"><img src="https://agentmods.dev/badge/rules/evilfreelancer/openapi-to-cli/testing/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 testing

Your own site · 80×15
<a href="https://agentmods.dev/rules/evilfreelancer/openapi-to-cli/testing"><img src="https://agentmods.dev/badge/rules/evilfreelancer/openapi-to-cli/testing.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 579 This file is loaded in full into every session.
When invoked 579 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.00579 $0.00579
Opus 5.5 $0.00232 $0.00232
Sonnet 5.5 $0.00116 $0.00116
Haiku 4.5 $0.00058 $0.00058

Measured 1mo ago against content hash cfd1ba0524b8, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, 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 1mo 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.mdc · 53 lines

How it starts

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

Test conventions (Jest)

Applies when editing or adding files under tests/.

Layout

  • All tests live in tests/ alongside the matching src/ module.
  • Test files: tests/<module>.test.ts (one per src/<module>.ts).
  • Shared inputs in tests/fixtures/ (OpenAPI/Swagger documents, sample profiles). Recorded outputs in tests/results/.
  • github-api.test.ts and box-api-yaml.test.ts are large real-spec regression tests - do not hand-edit their fixtures.

Structure

  • Group with describe(<moduleName>, ...); one nested describe per public method or scenario.
  • Test names: it("does X when Y", ...) - describe behavior, not implementation.
  • Arrange / Act / Assert order inside each it. Blank lines between the three sections are encouraged.

Isolation

  • Each it is independent. Use beforeEach/afterEach for setup and teardown, not module-level mutable state.
  • Mock fs and axios (HttpClient) through the constructor options the modules expose. Do not monkey-patch the real fs/axios modules in tests.
  • For .ocli/ fixtures, use fs.mkdtempSync(os.tmpdir() + "/...") and clean up in afterEach.

Running

npm test                                # full Jest suite
npx jest tests/<file>.test.ts           # one file
npx jest tests/<file>.test.ts -t "X"    # one test by name

What to assert

  • Public behavior visible at the module boundary - return values, written files, requests issued via the mocked HttpClient, captured stdout.
  • For BM25 / command-search - assert ranking order and matched commands, not internal scores.
  • For openapi-to-commands - assert the resulting CliCommand[] structure (names, options, body schema), not intermediate spec normalization.

What not to assert

  • Internal helper signatures, private state, exact log strings - those are implementation details.
  • Floating-point BM25 scores beyond ranking order.

Fixtures

  • Add new spec fixtures only when an existing one cannot reproduce the case. Keep them minimal: one path, one operation, only the fields needed for the test.
  • For tests covering spec features (OAS 3 requestBody, Swagger 2 formData, multi-file $ref, header/cookie params), name the fixture after the feature, e.g. tests/fixtures/swagger2-formdata.yaml.

Read the full file on GitHub · 53 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. 1mo ago Changed · -1 tokens per session cfd1ba0524b8
  2. 1mo ago First seen · 53 lines · 580 tokens per session scan A 7b9f08e1f77a

Subscribe to this mod's changes

testing is a cursor rule published in the GitHub repository EvilFreelancer/openapi-to-cli (265 stars, last pushed 26d ago), licensed MIT. It adds 579 tokens to every session, about $0.0023 per session on Opus 5.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.