Skip to content

Commit

Permalink
✨ 【TODO】 フランの計算を追加
Browse files Browse the repository at this point in the history
  • Loading branch information
dodonki1223 committed Jan 9, 2022
1 parent 00557eb commit 35376db
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
3 changes: 1 addition & 2 deletions TODO.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
- [ ] $5 + $5がMoneyを返す
- [ ] Money の丸め処理どうする?
- [ ] 他のオブジェクトとの等価性比較
- [ ] 5CHF * 2 = 10CHF

- [x] 5CHF * 2 = 10CHF
- [x] Sum.plus
- [x] Expression.times
- [x] $5 + 10 CHF = $10(レートが 2:1 の場合)
- [x] $5 + $5 = $10
- [x] Bank.reduce(Money)
- [x] Money を変換して換算を行う
- [x] Reduce(Bank,String)

- [x] amount を private にする
- [x] Dollar の副作用どうする?
- [x] nullとの等価性比較
Expand Down
9 changes: 6 additions & 3 deletions src/__tests__/money.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,13 @@ test('currency', () => {
});

test('times', () => {
const five: Money = Money.dollar(5);
const fiveBucks: Money = Money.dollar(5);
const fiveFrancs: Money = Money.franc(5);

expect(five.times(2)).toEqual(Money.dollar(10));
expect(five.times(3)).toEqual(Money.dollar(15));
expect(fiveBucks.times(2)).toEqual(Money.dollar(10));
expect(fiveBucks.times(3)).toEqual(Money.dollar(15));
expect(fiveFrancs.times(2)).toEqual(Money.franc(10));
expect(fiveFrancs.times(3)).toEqual(Money.franc(15));
});

test('test reduce sum', () => {
Expand Down

0 comments on commit 35376db

Please sign in to comment.