Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
♻️ 【第1章 仮実装】Dollar クラスを作成しコンパイルエラーを解消する
<テスト駆動開発(TDD)の流れ> ✅ 1. まずはテストを1つ書く ✅ 2. すべてのテストを走らせ、新しいテストの失敗を確認する 3. 小さな変更を行う 4. すべてのテストを走らせ、すべて成功することを確認する 5. リファクタリングを行って重複を除去する ・以下の問題点があるのでこれを解消しコンパイルを通す ・Dollarクラスがない ・コンストラクタがない ・times メソッドがない ・amount フィールドが無い ・テストを実行するとコンパイルエラーは解消され、テストに失敗することを確認できる ``` /usr/src # yarn run test src/__tests__/dollar.test.ts FAIL src/__tests__/dollar.test.ts ✕ times (11 ms) ● times expect(received).toBe(expected) // Object.is equality Expected: 10 Received: 5 11 | const five = new Dollar(5); 12 | five.times(2) > 13 | expect(five.amount).toBe(10); | ^ 14 | }); 15 | at Object.<anonymous> (src/__tests__/dollar.test.ts:13:23) Test Suites: 1 failed, 1 total Tests: 1 failed, 1 total Snapshots: 0 total Time: 4.039 s, estimated 6 s ```
- Loading branch information