Refactor + ajout de tests