testing

testing is a cursor rule for Cursor from brendadeeznuts1111/betting-brain-v3. It costs 0 tokens per session (737 once invoked), scanned A, original, MIT.

A set of project rules for writing and organizing tests with Bun Test, a testing tool for TypeScript and JavaScript. It covers test structure, file names, and separate folders for unit, integration, and end-to-end tests.

In plain words
What is it for?
Use it when adding or updating tests, choosing test file names, or organizing shared mocks and test utilities.
Why use it?
It keeps tests consistent and helps the test runner find them reliably. Separating test types also makes the codebase easier to navigate.

Cursor rule for Cursor

Written for Cursor: installed under .cursor/.

Not installable on its own: it reads a path above its own folder, which only exists inside its repository. The line is import { createMockEnv } from "../mocks/env";.

Install

Getting it into your agent

There is no command for this one: it runs only inside a plugin, and the catalogue could not identify which plugin ships it. The source is linked below.

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/brendadeeznuts1111/betting-brain-v3/testing.svg)](https://agentmods.dev/rules/brendadeeznuts1111/betting-brain-v3/testing)
Your own site
<a href="https://agentmods.dev/rules/brendadeeznuts1111/betting-brain-v3/testing"><img src="https://agentmods.dev/badge/rules/brendadeeznuts1111/betting-brain-v3/testing.svg" alt="Measured on agentmods" height="20"></a>
Per session 0 Nothing until a file matches its globs; then the whole rule loads.
When invoked 737 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.1 $0.00000 $0.00737
Opus 5 $0.00000 $0.00368
Sonnet 5 $0.00000 $0.00147
Haiku 4.5 $0.00000 $0.00074

Measured 6d ago against content hash 52bed3d4f875, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-06, 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 6d 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 · 119 lines

How it starts

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

Testing Rules

Test Runner: Bun Test

Use Bun Test exclusively - not Vitest, not Jest.

Test File Structure

import { describe, test, expect, beforeEach, afterEach } from "bun:test";

describe("Component/Feature Name", () => {
  beforeEach(() => {
    // Setup
  });

  test("should do something specific", () => {
    // Arrange
    const input = "test";
    
    // Act
    const result = myFunction(input);
    
    // Assert
    expect(result).toBe("expected");
  });
});

File Organization

tests/
├── unit/                # Unit tests (9 files)
│   ├── clv.test.ts
│   ├── exposure.test.ts
│   ├── sharp.test.ts
│   └── ...
├── integration/         # Integration tests (8 files)
│   ├── integration.test.ts
│   ├── queue-integration.test.ts
│   └── ...
├── e2e/                 # End-to-end tests
├── mocks/               # Shared test mocks
│   ├── data.ts
│   └── env.ts
├── setup/               # Test configuration
└── utils/               # Test utilities

File Naming

Bun Test discovers files matching these patterns:

  • *.test.{ts,tsx}
  • *_test.{ts,tsx}
  • *.spec.{ts,tsx}
  • *_spec.{ts,tsx}

Preferred: *.test.ts (e.g., clv.test.ts)

Running Tests

# All tests
bun test

# Single file
bun test tests/unit/clv.test.ts

# With coverage
bun test --coverage

# Watch mode
bun test --watch

# Specific pattern
bun test --test-name-pattern "CLV"

Mock Environment

See tests/mocks/env.ts for Cloudflare Workers environment mocks.

import { createMockEnv } from "../mocks/env";

test("should use mocked environment", () => {
  const env = createMockEnv();
  // Use env.ANALYTICS, env.KV, etc.
});

Test Data

See tests/mocks/data.ts for shared test fixtures.

Important Patterns

  1. No backup files: Never create *.test.ts.backup files
  2. Clean imports: Use Bun Test imports only
  3. Type safety: Leverage src/types/api.ts
  4. Fail fast: Tests should fail fast on errors
  5. Mock external services: Never call real APIs in tests

Read the full file on GitHub · 119 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. 6d ago First seen · 119 lines · 0 tokens per session scan A 52bed3d4f875

Subscribe to this mod's changes

testing is a cursor rule published in the GitHub repository brendadeeznuts1111/betting-brain-v3 (8 stars, last pushed 11mo ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 737 tokens. 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.