1.0.0 • Published 9 months ago
csd4503_s1_a2 v1.0.0
Dynamic Trio
Can Zorbey Tarhan Smilepreet Sudeshna
Bookstore Application
This project implements a simple bookstore application with TypeScript and includes Jest tests.
Running the Tests
To run the tests, follow these steps:
- Ensure you have Node.js installed on your system.
- Open a terminal and navigate to the project directory.
- Install dependencies by running:
- Run the tests using the command:
Test Cases
1. Adding a Book (addBook.test.ts)
- Verifies that a book can be successfully added to the bookstore.
- Checks that adding a book with an empty title throws an error.
Expected output:
2. Borrowing a Book (borrowBook.test.ts)
- Tests if a customer can borrow an available book.
- Checks that borrowing a non-existent book fails.
Expected output:
3. Returning a Book (returnBook.test.ts)
- Verifies that a customer can return a borrowed book.
- Checks that returning a book that wasn't borrowed fails.
Expected output:
Project Structure
src/
: Contains the source code for the Bookstore applicationBook.ts
: Defines the Book classCustomer.ts
: Defines the Customer classBookstore.ts
: Implements the Bookstore functionalityindex.ts
: Main entry point of the application
test/
: Contains Jest test filesaddBook.test.ts
borrowBook.test.ts
returnBook.test.ts
package.json
: Project configuration and dependenciestsconfig.json
: TypeScript configurationjest.config.js
: Jest configuration for TypeScript
1.0.0
9 months ago