- 개발 사이클
- Refactoring: 테스트코드->fail->코드작성->success-> 반복해서 코드를 작성완료함.
- Mocking: 가짜로 대체하는 기법
TDD
refBlog
- 작성순서: 선 테스트코드 후 실제코드
- 영상 → docs → 블로그
- 유닛테스트: 서비스 메소드 단위.
code coverage
medium, web.dev
what: a metric that can help you understand how much of your source code is tested.
problem: code hacked or security
solution: white-testing → it guarantee that you are testing all possible outcome your functions.
- Metrics
- Funcs: the percentage of functions in your code that your tests call.
- example: In the code example, there are two functions: calcCoffeeIngredient and isValidCoffee. The tests only call the calcCoffeeIngredient function, so the function coverage is 50%.
- Lines: the percentage of executable code lines that your test suite executed.
- Branch: the percentage of executed branches or decision points in the code, such as if statements or loops.
- Statement: similar to line coverage
Nest.js
1-1. Services