Skip to content
Back to skills

Testing Fundamentals

ASecurity

``` ╱╲ ╱ ╲ E2E (few) ╱────╲ ╱ ╲ Integration (some) ╱────────╲ ╱ ╲ Unit (many) ╱────────────╲ ``` ```typescript // user.service.test.ts import { describe, it, expect, vi } from 'vitest' import { UserService } from './user.service' describe('UserService', () => { it('should create user', async () => { const mockRepo = { create: vi.fn().mockResolvedValue({ id: '1', email: 'test@test.com' }) } co

  • 21 stars
  • 0 votes
  • 0 copies
  • 7 views
  • Added September 7, 2026
testingtypescripttestingapi

Works with

  • api

Security analysis

A100/100

Scanned September 7, 2026

npx -y skills add modbender/skill-library-mcp --skill testing-fundamentals --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Testing Fundamentals?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Testing Fundamentals
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/modbender-testing-fundamentals/badge)](https://www.skillsdirectory.com/skills/modbender-testing-fundamentals)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
# Testing Fundamentals

## Test Pyramid

```
        ╱╲
       ╱  ╲      E2E (few)
      ╱────╲
     ╱      ╲    Integration (some)
    ╱────────╲
   ╱          ╲  Unit (many)
  ╱────────────╲
```

## Unit Testing

```typescript
// user.service.test.ts
import { describe, it, expect, vi } from 'vitest'
import { UserService } from './user.service'

describe('UserService', () => {
  it('should create user', async () => {
    const mockRepo = {
      create: vi.fn().mockResolvedValue({ id: '1', email: 'test@test.com' })
    }
    const service = new UserService(mockRepo)
    
    const user = await service.create({ email: 'test@test.com', name: 'Test' })
    
    expect(user.email).toBe('test@test.com')
    expect(mockRepo.create).toHaveBeenCalled()
  })
})
```

## Integration Testing

```typescript
// api/users.test.ts
import { describe, it, expect, beforeAll } from 'vitest'
import request from 'supertest'
import { app } from '../src/index'

describe('POST /users', () => {
  it('should create user', async () => {
    const res = await request(app)
      .post('/api/users')
      .send({ email: 'test@test.com', name: 'Test' })
    
    expect(res.status).toBe(201)
    expect(res.body.email).toBe('test@test.com')
  })
})
```

## Checklist

- [ ] Set up test framework (Vitest/Jest)
- [ ] Write unit tests for services
- [ ] Add integration tests for API
- [ ] Use test fixtures
- [ ] Mock external services
- [ ] Aim for 80% coverage on core logic

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in testing →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.