-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
✨ 【第1章 仮実装】TODOリストの中で一番簡単に実装できなそうな times メソッドのテストを追加
<テスト駆動開発(TDD)の流れ> ✅ 1. まずはテストを1つ書く 2. すべてのテストを走らせ、新しいテストの失敗を確認する 3. 小さな変更を行う 4. すべてのテストを走らせ、すべて成功することを確認する 5. リファクタリングを行って重複を除去する ・問題点は気にせず、まずはテストから書いていくこと ・コンパイルすらできないが、まずはテストから書いていくこと
- Loading branch information
1 parent
ac99b62
commit 33bbf98
Showing
2 changed files
with
19 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
- [ ] $5 + 10 CHF = $10(レートが 2:1 の場合) | ||
- [ ] $5 * 2 = $10 | ||
- [ ] amount を private にする | ||
- [ ] Dollar の副作用どうする? | ||
- [ ] Money の丸め処理どうする? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { Dollar } from '../dollar'; | ||
|
||
test('times', () => { | ||
/* | ||
「$5 * 2 = $10」のテスト | ||
現状では以下の問題点あり | ||
・フィールドは public | ||
・コードには副作用がある | ||
・金額なのに int型を使っている | ||
*/ | ||
const five = new Dollar(5); | ||
five.times(2) | ||
expect(five.amount).toBe(10); | ||
}); |