Introduction
-1,7 +1,18 @@
describe('Feature: Adding a book', () => {
test('Example: User can add a book', async () => {
// Pour l'instant je me contente d'écrire le code le plus simple possible
+ class BookRepository {
+ lastSavedBook: { title: string } | undefined;
+ }
+
const bookRepository = new BookRepository();
- const addBook = new AddBookUseCase(bookRepository);
+
+ class AddBookUseCase {
+ async execute(book: { title: string }) {
+ bookRepository.lastSavedBook = book;
+ }
+ }
+
+ const addBook = new AddBookUseCase();
await addBook.execute({ title: 'Clean Code' });


Last updated

