jest-hands-on/src/test-writing-style.md

16 lines
493 B
Markdown
Raw Normal View History

2022-02-24 17:06:32 +09:00
# テストの作法
テストを書くときの代表的な作法を紹介します。
## Arrange・Act・Assert (AAA) パターン
テストを書くときの作法の1つです。
準備 (Arrange)・実行 (Act)・検証 (Assert) というプロセスで分けて書きます。
準備・実行・検証をそれぞれ分けて書いておくことで比較的読みやすいテストを書くことができます。
例:
```js
2022-03-02 15:59:13 +09:00
{{#include test-writing-style/aaa-pattern.test.js}}
2022-02-24 17:06:32 +09:00
```