https://github.com/mrbrunelli/tdd-node-jest
My studies of test driven development (TDD) with Node.js
https://github.com/mrbrunelli/tdd-node-jest
jest node tdd
Last synced: 4 months ago
JSON representation
My studies of test driven development (TDD) with Node.js
- Host: GitHub
- URL: https://github.com/mrbrunelli/tdd-node-jest
- Owner: mrbrunelli
- Created: 2020-09-02T20:11:38.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2020-09-02T20:20:17.000Z (almost 5 years ago)
- Last Synced: 2025-01-15T20:53:20.066Z (6 months ago)
- Topics: jest, node, tdd
- Language: JavaScript
- Homepage:
- Size: 1.45 MB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## :heavy_check_mark: TDD Node + Jest
> My studies of Test-driven development with Node.js### Requisits
- [x] Node
- [x] Npm
- [x] Jest
- [x] Axios### To execute
> First install the dependencies
```bash
npm install
```
> Later, execute npm test
```bash
npm test
```
> For coverage details
```bash
npx jest --coverage
```
### Easy to test features
```javascript
const BranchController = require('./branch')const makeSut = (url) => {
const sut = new BranchController(url)
return sut.handle(url)
}describe('Branch Controller', () => {
test('Should return 200 if connect in /filial', async () => {
const statusCode = await makeSut('/api/filial')
expect(statusCode).toBe(200)
})test('Should return 500 if provided incorrectly route', async () => {
const statusCode = await makeSut('invalid_route')
expect(statusCode).toBe(500)
})
})
```