nestjs-starter test.instructions.md

A set of testing rules for a NestJS application, a framework for building server-side TypeScript programs.

In plain words
What is it for?
Use it when writing unit tests for services and other public methods, including normal results, errors, and dependency calls.
Why use it?
It makes tests more consistent by defining how to mock dependencies, structure cases, and check successful and failing behavior.

Instructions file for GitHub Copilot

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 instructions/hmake98/nestjs-starter/test
Clone the repo
git clone --depth 1 https://github.com/hmake98/nestjs-starter

Made for: GitHub Copilot.

Per session 291 This file is loaded in full into every session.
When invoked 291 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 $0.00291 $0.00291
Opus 5 $0.00146 $0.00146
Sonnet 5 $0.00058 $0.00058
Haiku 4.5 $0.00029 $0.00029

Measured 2d ago against content hash ce4ca2f8b6ff, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

nestjs-starter test.instructions.md 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 2d 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.

.github/instructions/test.instructions.md · 17 lines

What it actually says

Test Conventions

  • Mock every injected dependency as a plain object: const mockRepo = { method: jest.fn() }. Never use jest.createMockFromModule.
  • Provide mocks via { provide: Token, useValue: mockObject }.
  • ConfigService mock: { getOrThrow: jest.fn((key: string) => configMap[key]) } with a typed key→value map.
  • Never call jest.clearAllMocks() in beforeEach — handled globally by clearMocks: true in test/jest.json.
  • Use src/ path alias in imports, not relative ../../ paths.
  • Output path mirrors src/: src/modules/post/services/post.service.tstest/modules/post.service.spec.ts.
  • Faker: import @faker-js/faker normally — aliased to test/mocks/faker.mock.ts for deterministic values.
  • Structure: describe('ClassName') > describe('methodName') > it('should...').
  • Every public method needs: happy path (resolves.toEqual), guard/error throw (rejects.toThrow(HttpException)), dependency propagation.
  • Assertions: resolves.toEqual(...), rejects.toThrow(HttpException), toHaveBeenCalledWith(...). Never .toBeTruthy() for value checks.
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. 2d ago First seen · 17 lines · 291 tokens per session scan A ce4ca2f8b6ff

Subscribe to this mod's changes

nestjs-starter test.instructions.md is an instructions file published in the GitHub repository hmake98/nestjs-starter (61 stars, last pushed 3mo ago), licensed MIT. It adds 291 tokens to every session, about $0.0015 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-30.