Getting it into your agent
It runs from inside its repository, so the clone comes first — what it calls does not travel with the file alone.
git clone --depth 1 https://github.com/brendadeeznuts1111/betting-brain-v3npx agentmods add rules/brendadeeznuts1111/betting-brain-v3/testing-patternsWrote 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.
[](https://agentmods.dev/rules/brendadeeznuts1111/betting-brain-v3/testing-patterns)<a href="https://agentmods.dev/rules/brendadeeznuts1111/betting-brain-v3/testing-patterns"><img src="https://agentmods.dev/badge/rules/brendadeeznuts1111/betting-brain-v3/testing-patterns/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.
<a href="https://agentmods.dev/rules/brendadeeznuts1111/betting-brain-v3/testing-patterns"><img src="https://agentmods.dev/badge/rules/brendadeeznuts1111/betting-brain-v3/testing-patterns.svg" alt="Reviewed on agentmods" width="80" height="20"></a>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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00000 | $0.02968 |
| Opus 5.5 | $0.00000 | $0.01187 |
| Sonnet 5.5 | $0.00000 | $0.00594 |
| Haiku 4.5 | $0.00000 | $0.00297 |
Grade A, and why
testing-patterns 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.
How it starts
The opening of the file, as written. The whole thing — 489 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Testing Patterns for Bun Test
🔍 Code Searchability Patterns
Find Testing Issues with ast-grep
# Find incorrect test imports (should use bun:test)
ast-grep --pattern 'import { describe, test, expect } from "vitest"' tests/
ast-grep --pattern 'import { describe, test, expect } from "@jest/globals"' tests/
sg -p 'from "vitest"' tests/
sg -p 'from "@jest/globals"' tests/
# Find missing process cleanup
ast-grep --pattern 'Bun.spawn($$$)' tests/
sg -p 'Bun.spawn' tests/
# Find missing afterEach cleanup
ast-grep --pattern 'afterEach($$$)' tests/
sg -p 'afterEach' tests/
# Find test files without proper structure
ast-grep --pattern 'describe($$$)' tests/
sg -p 'describe' tests/
# Find timeout issues
ast-grep --pattern 'timeout: $NUM' tests/
sg -p 'timeout:' tests/
Testing Discovery Commands
# Find all test files
find tests/ -name "*.test.ts" -o -name "*.spec.ts"
# Find test patterns
sg search 'describe(' tests/
sg search 'test(' tests/
sg search 'expect(' tests/
# Find test utilities
sg search 'processManager' tests/
sg search 'createMockEnv' tests/
Test Structure
Use Proper Imports
// ✅ CORRECT - Bun test imports
import { describe, test, expect, beforeEach, afterEach, beforeAll, afterAll } from 'bun:test';
// ❌ WRONG - Don't use Vitest/Jest
import { describe, test, expect } from 'vitest';
import { describe, test, expect } from '@jest/globals';
Process Cleanup in Tests
ALWAYS cleanup spawned processes:
import processManager from '../utils/process-cleanup';
describe('My Test Suite', () => {
// Cleanup after EACH test
afterEach(async () => {
await processManager.killAll(3000);
});
// Or cleanup after ALL tests
afterAll(async () => {
await processManager.killAll(3000);
});
});
Test Timeouts
Global Timeout (bunfig.toml)
[test]
timeout = 10000 # 10 seconds default
Per-Test Timeout
test('long running test', async () => {
// Test code
}, { timeout: 30000 }); // 30 seconds
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.
- 1mo ago First seen · 489 lines · 0 tokens per session scan A 4f9b4c4208ea
testing-patterns is a cursor rule published in the GitHub repository brendadeeznuts1111/betting-brain-v3 (8 stars, last pushed 6d ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 2,968 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.
Other cursor rules, from other repositories
test-database-limitations
Test databases created via withDevDatabase() from @repo/test-utils use pglite (an in-memory PostgreSQL implementation via @prisma/dev). Pglite does not support PostgreSQL extensions like pgvector, pgtrgm, etc.
test-file-organization
Test file organization and splitting guidelines.
typed-contract-in-tests
Use typed Contract from fixtures in integration tests.
use-contract-ir-factories
Use factory functions for creating ContractIR objects instead of manual object creation.
running-tests
How to run tests, check for failures, and rerun specific failing tests — use the :agent variants of slow commands.
sql-orm-client-whole-shape-assertions
Prefer whole-result-shape assertions with explicit select projections in sql-orm-client tests.