일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- 더채플엣청담
- 레이아웃
- 생각
- swiftUI
- AlignmentGuide
- 시계방향
- Double Linked List
- Universal Hashing
- Optional
- hstack
- layout
- 좌표공간
- nodejs
- optional binding
- Linked List
- SWIFT
- 각도
- 다짐
- stack
- 자료구조
- 결혼식장계약후기
- enum
- JavaScript
- Test
- Hashing
- vstack
- 베뉴
- Optional Chaining
- Today
- Total
klioop for iOS
Jest, nodeJS test tool 본문
Jest is a testing framework for javascript libarary such as react and nodeJS. It's like pytest in python.
Fisrt thing to do to use jest is, of course, install it. On terminal or command line, enter following
> npm install jest
After jest is installed, whenever you have files named like xxx.test.js, jest will find them for testing.
For executing tests, enter on your terminal
> npm test
To use jest, unlike other modules, you don't need to import or require it.
Jest provides test functions as a global in the test suite files.
When test functions are called with the name of the functions, jest executes callback functions in that test function.
If the callback function throws an error, then the test is considered a failure.
If the callback function do not throw an error, the test is considered a success.
const addTwoNumber = (a, b) {
return a + b
}
test("Should add two integer numbers", () => {
const result = addTwoNumber(1, 2)
expect(result).toBe(3)
})
// The above test will not throw an error, so that the test is a success.
'nodejs' 카테고리의 다른 글
unit test 의 필요성 (0) | 2021.03.01 |
---|