You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: readme-fr.md
+8-7Lines changed: 8 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1076,23 +1076,24 @@ test("Whenever no data is passed, error metric shows zero", () => {
1076
1076
1077
1077
<br/>
1078
1078
1079
-
## ⚪ ️ 3.3 Whenever possible, test with a realistic and fully rendered component
1079
+
## ⚪ ️ 3.3 Lorsque c'est possible, test avec un composant réaliste et totalement rendu
1080
1080
1081
-
:white_check_mark:**Do:** Whenever reasonably sized, test your component from outside like your users do, fully render the UI, act on it and assert that the rendered UI behaves as expected. Avoid all sort of mocking, partial and shallow rendering - this approach might result in untrapped bugs due to lack of details and harden the maintenance as the tests mess with the internals (see bullet 'Favour blackbox testing'). If one of the child components is significantly slowing down (e.g. animation) or complicating the setup - consider explicitly replacing it with a fake
1081
+
:white_check_mark:**Do:** Lorsqu'ils sont de taille raisonnable, tests tes composants de l'exterieur comme le font tes utilisateurs, rend complètement l'UI, agit dessus, et vérifie que l'UI rendu se comporte comme on l'attend.
1082
+
Évite toute sorte de mocking, de rendu partiels ou superficiel - cette approche peut résulter en bugs non détéctés à cause du manque de détails et rendre plus difficile la maintenance des tests puisque les tests modifie les propiétés interne (voir le point 'Privilégier les tests blackbox'). Si l'un des composants enfants ralenti significativement (e.g animations) ou complique la configuration - considère de le remplacer explicitement avec un faux.
1082
1083
1083
-
With all that said, a word of caution is in order: this technique works for small/medium components that pack a reasonable size of child components. Fully rendering a component with too many children will make it hard to reason about test failures (root cause analysis) and might get too slow. In such cases, write only a few tests against that fat parent component and more tests against its children
1084
+
Maintenant que c'est dit, une mise en garde s'impose: cette technique fonctionne pour des petit/moyens composants qui ont un nombre raisonnable de composants enfants. Rendre complètement un composants avec trop d'enfant compliquera le raisonnement à propos des échecs de tests (analyse de la cause originelle) et peut être trop lent. Dans ces cas, écrit seulement quelques tests pour ce parent, et plus de tests pour ses enfants.
1084
1085
1085
1086
<br/>
1086
1087
1087
-
❌ **Otherwise:**When poking into a component's internal by invoking its private methods, and checking the inner state - you would have to refactor all tests when refactoring the components implementation. Do you really have a capacity for this level of maintenance?
1088
+
❌ **Autrement:**Lorsque tu fouilles dans les détails interne du composants en invoquant ses méthodes privée, et en vérifiant l'état interne - tu devra refactorer tout les tests lorsque tu refactorera l'implémentation du composants. Est-ce que tu as vraiment la capacité de tenir ce niveau de maintenance?
<details><summary>✏ <b>Exemple de code</b></summary>
1092
1093
1093
1094
<br/>
1094
1095
1095
-
### :clap:Doing It Right Example: Working realistically with a fully rendered component
1096
+
### :clap:Bien faire les choses, exemple: Travailler de façon réaliste sur un composant complètement rendu
1096
1097
1097
1098

1098
1099
@@ -1124,7 +1125,7 @@ test("Realistic approach: When clicked to show filters, filters are displayed",
1124
1125
});
1125
1126
```
1126
1127
1127
-
### :thumbsdown:Anti-Pattern Example: Mocking the reality with shallow rendering
1128
+
### :thumbsdown:Exemple d'anti pattern: Mocker la réalité avec un rendu superficiel
1128
1129
1129
1130
```javascript
1130
1131
test("Shallow/mocked approach: When clicked to show filters, filters are displayed", () => {
0 commit comments