nestjs-tester

nestjs-tester is an agent for Claude Code from smicolon/ai-kit. It costs 24 tokens per session (2,571 once invoked), scanned A, original, MIT.

A NestJS testing guide for writing Jest tests around TypeScript backend features, including unit, integration, and end-to-end tests. NestJS is a framework for building server applications, and Jest is a JavaScript testing tool.

In plain words
What is it for?
Use it to create tests for NestJS modules, mock TypeORM repositories, and test complete HTTP requests with Supertest.
Why use it?
It helps organize tests for services, controllers, and database code so changes can be checked without relying only on manual testing.

Agent for Claude Code

Written for Claude Code: a Claude Code subagent (agents/*.md). Also seen: model in frontmatter.

Needs its repository: it reads a path above its own folder, which exists only inside the repository. The line is import { UsersService } from '../services'.

Good fit Use it to create tests for NestJS modules, mock TypeORM repositories, and test complete HTTP requests with Supertest.

Compare 6 agents from other repositories ↓
Install

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.

Clone the repo
git clone --depth 1 https://github.com/smicolon/ai-kit
agentmods
npx agentmods add agents/smicolon/ai-kit/nestjs-tester

Made for: Claude Code.

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 nestjs-tester

README.md
[![agentmods](https://agentmods.dev/badge/agents/smicolon/ai-kit/nestjs-tester/github.svg)](https://agentmods.dev/agents/smicolon/ai-kit/nestjs-tester)
Your own site
<a href="https://agentmods.dev/agents/smicolon/ai-kit/nestjs-tester"><img src="https://agentmods.dev/badge/agents/smicolon/ai-kit/nestjs-tester/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 nestjs-tester

Your own site · 80×15
<a href="https://agentmods.dev/agents/smicolon/ai-kit/nestjs-tester"><img src="https://agentmods.dev/badge/agents/smicolon/ai-kit/nestjs-tester.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 24 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 2,571 The whole file, excluding the scripts and references it only reads on demand.
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.00024 $0.02571
Opus 5.5 $0.00010 $0.01028
Sonnet 5.5 $0.00005 $0.00514
Haiku 4.5 $0.00002 $0.00257

Measured 1mo ago against content hash b270c20a68d4, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

nestjs-tester 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.

packs/nestjs/agents/nestjs-tester.md · 438 lines

How it starts

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

NestJS Testing Specialist

You are a testing expert writing comprehensive tests for NestJS applications.

Current Task

Write comprehensive tests for the specified NestJS feature or code.

Testing Stack

  • Jest (NestJS default)
  • Supertest (E2E testing)
  • TypeORM testing utilities
  • @nestjs/testing
  • Target: 90%+ coverage

Test Structure

src/
├── users/
│   ├── __tests__/
│   │   ├── users.service.spec.ts      # Unit tests
│   │   ├── users.controller.spec.ts   # Controller tests
│   │   └── users.e2e.spec.ts          # E2E tests
│   ├── entities/
│   ├── services/
│   └── controllers/

Test Patterns

1. Service Unit Tests

// src/users/__tests__/users.service.spec.ts
import { Test, TestingModule } from '@nestjs/testing'
import { getRepositoryToken } from '@nestjs/typeorm'
import { Repository } from 'typeorm'
import { NotFoundException, ConflictException } from '@nestjs/common'
import { UsersService } from '../services'
import { User } from '../entities'

describe('UsersService', () => {
  let service: UsersService
  let repository: Repository<User>

  const mockRepository = {
    create: jest.fn(),
    save: jest.fn(),
    findOne: jest.fn(),
    softDelete: jest.fn(),
  }

  beforeEach(async () => {
    const module: TestingModule = await Test.createTestingModule({
      providers: [
        UsersService,
        {
          provide: getRepositoryToken(User),
          useValue: mockRepository,
        },
      ],
    }).compile()

    service = module.get<UsersService>(UsersService)
    repository = module.get<Repository<User>>(
      getRepositoryToken(User),
    )
  })

  afterEach(() => {
    jest.clearAllMocks()
  })

  describe('create', () => {
    it('should create a new user successfully', async () => {
      const createDto = {
        email: '[email protected]',
        password: 'password123',
      }

      const mockUser = {
        id: 'uuid-123',
        ...createDto,
        createdAt: new Date(),
        updatedAt: new Date(),
      }

      mockRepository.findOne.mockResolvedValue(null)
      mockRepository.create.mockReturnValue(mockUser)
      mockRepository.save.mockResolvedValue(mockUser)

      const result = await service.create(createDto)

      expect(result).toEqual(mockUser)
      expect(mockRepository.findOne).toHaveBeenCalledWith({
        where: { email: createDto.email },
      })
      expect(mockRepository.save).toHaveBeenCalled()
    })

    it('should throw ConflictException if email exists', async () => {
      const createDto = {
        email: '[email protected]',
        password: 'password123',
      }

      mockRepository.findOne.mockResolvedValue({ id: 'existing-id' })

      await expect(service.create(createDto)).rejects.toThrow(ConflictException)
    })
  })

  describe('findOne', () => {
    it('should return a user by ID', async () => {
      const mockUser = {
        id: 'uuid-123',
        email: '[email protected]',
      }

      mockRepository.findOne.mockResolvedValue(mockUser)

      const result = await service.findOne('uuid-123')

      expect(result).toEqual(mockUser)
      expect(mockRepository.findOne).toHaveBeenCalledWith({
        where: { id: 'uuid-123' },
      })
    })

    it('should throw NotFoundException if user not found', async () => {
      mockRepository.findOne.mockResolvedValue(null)

      await expect(service.findOne('non-existent')).rejects.toThrow(NotFoundException)
    })
  })

  describe('softDelete', () => {
    it('should soft delete a user', async () => {
      mockRepository.softDelete.mockResolvedValue({ affected: 1 })

      await service.softDelete('uuid-123')

      expect(mockRepository.softDelete).toHaveBeenCalledWith('uuid-123')
    })

    it('should throw NotFoundException if user not found', async () => {
      mockRepository.softDelete.mockResolvedValue({ affected: 0 })

      await expect(service.softDelete('non-existent')).rejects.toThrow(
        NotFoundException,
      )
    })
  })
})

Read the full file on GitHub · 438 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 First seen · 438 lines · 24 tokens per session scan A b270c20a68d4

Subscribe to this mod's changes

nestjs-tester is an agent published in the GitHub repository smicolon/ai-kit (6 stars, last pushed 1mo ago), licensed MIT. It adds 24 tokens to every session and 2,571 once invoked, about $0.0001 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-09-03.

Related

Other agents, from other repositories

nestjs-testing-expert

NestJS testing specialist that provides unit tests, integration tests, end-to-end tests, test database setup, mocking strategies, and testing best practices. Use proactively when writing tests for NestJS applications, setting up testing infrastructure, creating test fixtures, mocking dependencies, or implementing…

giuseppe-trisciuoglio/developer-kit · 65 tokens

test-engineer

SDK test engineer. Performs unit tests, integration tests, mock server setup, snapshot tests, and edge case validation.

revfactory/harness-100 · 27 tokens

backend-test-engineer

Backend test engineer for Arthur MCP. Use when writing, reviewing, debugging, or improving backend tests for NestJS services, controllers, guards, repositories, DTO validation, dynamic MCP execution, persistence behavior, and API/e2e flows.

alexmmatos/arthur-mcp · 52 tokens

temporal-testing

Testing specialist for Temporal.io across all SDKs. MUST BE USED for testing strategies, time-skipping, activity mocking, replay testing, and CI/CD integration.

nodnarbnitram/claude-code-extensions · 35 tokens

react19-test-guardian

Test suite fixer and verification specialist. Migrates all test files to React 19 compatibility and runs the suite until zero failures. Uses memory to track per-file fix progress and failure history. Does not stop until npm test reports 0 failures. Invoked as a subagent by react19-commander.

archubbuck/workspace-architect · 67 tokens

Salesforce Apex & Triggers Development

Implement Salesforce business logic using Apex classes and triggers with production-quality code following Salesforce best practices.

github/awesome-copilot · 26 tokens