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/test-setup-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/test-setup-patterns)<a href="https://agentmods.dev/rules/brendadeeznuts1111/betting-brain-v3/test-setup-patterns"><img src="https://agentmods.dev/badge/rules/brendadeeznuts1111/betting-brain-v3/test-setup-patterns.svg" alt="Measured on agentmods" 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.01139 |
| Opus 5 | $0.00000 | $0.00570 |
| Sonnet 5 | $0.00000 | $0.00228 |
| Haiku 4.5 | $0.00000 | $0.00114 |
Grade A, and why
test-setup-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 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.
How it starts
The opening of the file, as written. The whole thing — 202 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Test Setup Patterns
Global Test Configuration
Test Setup File: tests/setup/test-setup.ts
import { vi, beforeAll, beforeEach, afterEach, expect } from 'bun:test';
import { createAnalyticsEngineStub } from '../utils/analytics-engine-stub';
// Global analytics stub instance
let globalAnalyticsStub: ReturnType<typeof createAnalyticsEngineStub> | null = null;
let currentTestName: string = '';
export function getGlobalAnalyticsStub() {
return globalAnalyticsStub;
}
export function setCurrentTestName(name: string) {
currentTestName = name;
}
Auto-Flush Pattern
Analytics Tests Only
afterEach(function () {
if (currentTestName.toLowerCase().includes('analytics') && globalAnalyticsStub) {
globalAnalyticsStub.flush();
}
vi.restoreAllMocks();
});
Test Name Detection
// In analytics tests, always set test name
test('should track analytics calls with stub', async () => {
setCurrentTestName('should track analytics calls with stub');
// Test implementation
});
Mock Environment Pattern
Create Mock Environment
import { createMockEnv } from '../utils/test-helpers';
describe('My Analytics Test', () => {
let mockEnv: any;
let analytics: any;
beforeEach(() => {
const mock = createMockEnv();
mockEnv = mock.env;
analytics = mock.analytics;
});
});
Use Global Stub
// ✅ CORRECT: Use global stub
const analytics = getGlobalAnalyticsStub();
// ❌ WRONG: Create duplicate stubs
const analytics1 = createAnalyticsEngineStub();
const analytics2 = createAnalyticsEngineStub();
Test Isolation Patterns
Fresh Stub Per Test
beforeEach(() => {
// Create fresh analytics stub for each test
globalAnalyticsStub = createAnalyticsEngineStub();
});
Console Mocking
beforeEach(() => {
vi.spyOn(console, 'log').mockImplementation(() => {});
vi.spyOn(console, 'error').mockImplementation(() => {});
vi.spyOn(console, 'warn').mockImplementation(() => {});
});
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.
- 6d ago First seen · 202 lines · 0 tokens per session scan A f53ef440fcd3
test-setup-patterns 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 1,139 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
workflow-deployment
Workflow testing and deployment process guide.
writing-tests
How to write tests in the monorepo.
manual-review.data-readiness
Manual Review data-readiness 規約——propose 階段準備驗收資料的 hard rule、[review:ui] 純功能驗證 step actionability、@no-manual-review-check marker schema、截圖檔名配對;寫 proposal.md / tasks.md 時 path-scoped 載入.
manual-review.evidence
Manual Review evidence 規約——寫 / 審 tasks.md 的 ## 人工檢查 區塊時 path-scoped 載入.
manual-review
人工檢查(Manual Review)主檔——核心 invariant、Item Kind Marker、annotation schema、Parent State Derivation、Post-Edit Gate;有 active spectra change(動 openspec/changes/)時載入.
testing-anti-patterns
Testing anti-patterns to avoid — mock 濫用、test-only production methods、不完整 mock、E2E fixture 寫死絕對日期、測試碼品質低於生產碼、測試結構契約.