์ผ | ์ | ํ | ์ | ๋ชฉ | ๊ธ | ํ |
---|---|---|---|---|---|---|
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 |
Tags
- di
- datepicker
- reflection
- fontstyle
- menutab
- ์ฝ๋์
- Factory Method Pattern
- Python
- ์ฑ์ฉํ์ ํ
- url
- Kotlin
- FACTORY
- AndroidStudio
- swagger
- udp
- Dialog
- 2024-08-20
- IOC
- ๊ฐ์ฒด์งํฅํ๋ก๊ทธ๋๋ฐ
- uri
- URN
- ์ด๋ ธํ ์ด์
- 2024-08-21
- http method
- ๊ธฐ์ด100์
- ํ๋ IT&E
- tcp
- OpenAPI
- Android Studio
- OOP
Archives
dingdong coding
jest ๋ณธ๋ฌธ
ํ ์คํธ ํ์์ฑ
- ์๋ฌ๊ฐ ๋ ๋๋ ๊ฒฝ์ฐ → ํ๊ท ํ ์คํธ
- ์ ์ง๋ณด์๋ฅผ ํด์ผํ๋ ๊ฒฝ์ฐ
- ๋ณต์กํ ์ฝ๋๋ฅผ ๋ง์ด ๋ฐ๊ฟ์ผ ํ๋ ๊ฒฝ์ฐ
- import ๋ฅผ ๋ง์ด ํ๋ ์ํฅ๋๊ฐ ๋์ ์ฝ๋
โญ ํ ์คํธ๋ ํํํ ์ถ๊ฐํ๊ณ , ์ ๋ง ๋์์ด ๋๋ ํ ์คํธ๋ฅผ ํ์. ๋น์ฐํ๊ฑฐ๋ ํ ์คํธ ํ์ง ๋ง์ โญ
ํ ์คํธ ์ข ๋ฅ
- ์ ๋: ํจ์๋ฅผ ํ ์คํธ ํจ
- ํตํฉ
- E2E
์ค์น
npm i jest -D
npm i ts-jest @types/jest -D
npm i babel-jest @babel/core
npm i cross-env // ์๋์ฐ ํธํ์ฉ ํจํค์ง
ํ ์คํธ ์์ ๊ด๋ จ ๋ช ๋ น์ด
npx ts-jest config:init
npx cross-env NODE_OPTIONS="$NODE_OPTIONS --experimental-vm-modules" npx jest
Visual Studio Code Jest Test Setting
1) settings.json
{
"jest.pathToJest": "**/node_modules/.bin/jest",
"jest.pathToConfig": "**/jest.config.js",
"jest.showCoverageOnLoad": true
}
2) Extension ์ถ๊ฐ
3) Ctrl+Shift + P
sum function
export function sum(x: number, y: number) {
return x + y;
}
xx.test.ts ๋๋ xx.spec.ts > test, spec ๋ ๋ค ๋จ
test("sum", () => {
expect(sum(1, 2)).toBe(3);
expect(sum(1, 2)).not.toBe(2);
});
toBe : ์์ ๊ฐ ๋น๊ต
not.toBe : toBe์ ๋ถ์ ํ
~ 2025.02.03
'๐ชTEST Code' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[ JUnit5 ] ์์ธ ํ ์คํธ (0) | 2022.06.17 |
---|
Comments