Part of Web Development - ISMIN 2020
Course followed by students of Mines St Etienne, ISMIN - M2 Computer Science.
The goal is to discover TypeScript and its ecosystem by implementing:
- 📙 A
Book
interface containing 3 string attributes:title
author
date
- 📚 A
Bookshelf
class that internally store books and have the following public functions:addBook(book: Book)
getBook(name: string)
returning aBook
getBooksOf(author: string)
returning an array ofBook
sgetAllBooks()
returning an array ofBook
sgetTotalNumberOfBooks()
returning a number
To guide you and help you find out if everything is ✅ a test suite is available in ./Bookshelf.test.ts
.
These tests can be ran using Jest in command line or inside your IDE.
Open a terminal, go to the directory of this TP and run the following commands:
# This will install all needed dependencies
npm install
# This will run the tests once
npm run test
OR
# This will run the tests everytime a change is made in the source code
npm run test:watch
# This will build the source and put the transpiled code in `/dist` directory
npm run build
That's it! You can code!
- Handle the
date
attribut as a date and not a string - Add a test, and a function
getBooksPublishedBefore(aDate: string | Date)
returning an array ofBook
s