Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | |||||
3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 | 11 | 12 | 13 | 14 | 15 | 16 |
17 | 18 | 19 | 20 | 21 | 22 | 23 |
24 | 25 | 26 | 27 | 28 | 29 | 30 |
Tags
- 이미지 갤러리 최적화
- 제너레이터와 async/await
- 전역변수의문제점
- 프론트엔드 성능 최적화 가이드
- Property Attribute
- var 사용금지
- 자바스크립트 딥다이브
- 스코프
- package management
- 이벤트
- 브라우저의 렌더링 과정
- 커리어
- 자바스크립트
- DOM
- 블로그 서비스 최적화
- 자바스크립트 패턴
- 딥다이브
- Babel과 Webpack
- 프로퍼티 어트리뷰트
- 올림픽 통계 서비스 최적화
- 비전공이지만 개발자로 먹고삽니다
- 프로그래머스
- 빌트인 객체
- 디스트럭처링
- Set과 Map
- const
- peerdependencies
- 모던 자바스크립트 Deep Dive
- ES6함수 추가기능
- 인터넷 장비
Archives
- Today
- Total
Dev Blog
Section 4: Writing Good Tests 본문
Online Lectures/JavaScript Unit Testing - The Practical
Section 4: Writing Good Tests
Nomad Kim 2023. 4. 5. 06:29What to & Not to Test
- What should & shouldn’t be tested
- Good tests are short & concise
key points
- What should & shouldn’t be tested
- Only test your code
- don't test third-party code
- don’t test what you cannot change
Example, fetch() API
- Don't test if it works as intended
- Don't test your server-side code implicitly via your client-side code
- Write separate tests for your backend code instead
Do Test your client-side reaction to different response & errors.
Writing Good Tests
1. AAA - Arrange - Act - Assert
2. 1 - Only test one thing
- For this, if function includes many code inside, separate it
3. focus - focus on the essence of a test when arranging
- Do not overuse meaningless cases. e.g. below. two numbers are enough for testing.
4. < - keep your number of assertions(”expect”) low
- avoid too many expects in a single it!
Only Test One Thing
What is one thing?
: means One feature! e.g. validate input OR transform it
'Online Lectures > JavaScript Unit Testing - The Practical' 카테고리의 다른 글
Section7: Mocking & Spies: Dealing with Side Effects (0) | 2023.04.05 |
---|---|
Section6: Advanced Testing Concepts (0) | 2023.04.05 |
Section 5: Integration Tests (0) | 2023.04.05 |
Section 3: Testing Basics (0) | 2023.03.28 |
Section 2: Setup & Testing Software (0) | 2023.03.28 |
Comments