Introduction

This book is no longer maintained, and will be deleted at some point!

 -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' });

Published on GitHub

An image

This book will teach you the basics of programming and Javascript. Whether you are an experienced programmer or not, this book is intended for everyone who wishes to learn the JavaScript programming language.

Illustration of 2 users
Illustration

JavaScript (JS for short) is the programming language that enables web pages to respond to user interaction beyond the basic level. It was created in 1995, and is today one of the most famous and used programming languages.

Last updated