> Mocha Integration Testing
HTTP API and database integration testing with Mocha and chai-http.
fetch
$
curl "https://skillshub.wtf/skillshub-team/catalog-batch5/mocha-integration?format=md"SKILL.md•Mocha Integration Testing
Mocha Integration Testing
HTTP API Tests
import chai from 'chai';
import chaiHttp from 'chai-http';
chai.use(chaiHttp);
const { expect } = chai;
describe('GET /api/users', () => {
it('returns users', async () => {
const res = await chai.request(app).get('/api/users');
expect(res).to.have.status(200);
expect(res.body).to.be.an('array');
});
it('creates user', async () => {
const res = await chai.request(app).post('/api/users')
.set('Authorization', 'Bearer token')
.send({ name: 'Alice', email: 'a@b.com' });
expect(res).to.have.status(201);
});
});
Database Tests
before(async () => { await db.migrate(); });
afterEach(async () => { await db.query('DELETE FROM users'); });
after(async () => { await db.close(); });
> related_skills --same-repo
> Nix Dev Shells with direnv
Auto-activate reproducible dev environments with Nix flakes and direnv.
> Dagger with GitHub Actions
Run Dagger CI/CD pipelines in GitHub Actions for portable, testable builds.
> Bun + Hono API
Build fast APIs with Bun runtime and Hono framework.
> Deno Fresh Framework
Build full-stack web apps with Fresh on Deno. Islands, routes, and zero runtime overhead.
┌ stats
installs/wk0
░░░░░░░░░░first seenMar 18, 2026
└────────────