Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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: about 1 month 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 (over 4 years ago)
- Default Branch: master
- Last Pushed: 2020-09-02T20:20:17.000Z (over 4 years ago)
- Last Synced: 2024-11-15T09:50:24.188Z (3 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
```![](./.github/terminal.png)
### 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)
})
})
```