| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 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 |
- layout
- swiftUI
- Hashing
- 레이아웃
- Linked List
- vstack
- 좌표공간
- 각도
- Optional
- JavaScript
- Test
- optional binding
- stack
- 생각
- Double Linked List
- Optional Chaining
- SWIFT
- hstack
- 자료구조
- enum
- Universal Hashing
- nodejs
- AlignmentGuide
- 시계방향
- 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 |
|---|