Skip to content

FernandoZnga/api-testing-starter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

API Testing Starter (Express + Jest + Supertest)

Node.js Version License: MIT Tests codecov Jest Express.js

This is a simple boilerplate for building and testing APIs using Express.js, Jest, and Supertest.

📁 Project Structure

src/                # Source code
  app.js            # Express app
  routes/           # API routes
  controllers/      # Route handlers
  services/         # Business logic

tests/              # All tests
  integration/      # API endpoint tests
  unit/             # Unit tests (services)
  __mocks__/        # Static mocks for testing

🧪 Run Tests

npm install
npm test

✅ Example Test

const request = require('supertest');
const app = require('../../src/app');

describe('GET /api/users', () => {
  it('should return 200 and a list of users', async () => {
    const res = await request(app).get('/api/users');
    expect(res.statusCode).toBe(200);
    expect(Array.isArray(res.body)).toBe(true);
  });
});

📦 Dependencies

  • Express
  • Jest
  • Supertest

📄 License

MIT

About

Simple API testing boilerplate with Express.js, Jest, and Supertest

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published