Skip to content

Commit

Permalink
content(tdd by example): fix code example on multiplication
Browse files Browse the repository at this point in the history
  • Loading branch information
mkrtchian committed Jun 24, 2024
1 parent b18f1f5 commit fa0839a
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions pages/books/test-driven-development-by-example.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -72,15 +72,23 @@
- Lui ajouter une variable membre _amount_.
```typescript
class Dollar {
public amount: number = 0;
public amount: number;
constructor(amount: number) {
this.amount = 0;
}

times(multiplier: number) {}
}
```
- On peut enfin **jouer le test et le voir échouer**.
- On fait **passer le test de la manière la plus rapide** :
```typescript
class Dollar {
public amount: number = 10;
public amount: number;
constructor(amount: number) {
this.amount = 10;
}

times(multiplier: number) {}
}
```
Expand All @@ -90,7 +98,11 @@
- On peut commencer par remplacer `10` par `5 * 2`.
```typescript
class Dollar {
public amount: number = 5 * 2;
public amount: number;
constructor(amount: number) {
this.amount = 5 * 2;
}

times(multiplier: number) {}
}
```
Expand Down

0 comments on commit fa0839a

Please sign in to comment.