1.0.0 • Published 9 months ago

csd4503_s1_a2 v1.0.0

Weekly downloads
-
License
ISC
Repository
-
Last release
9 months ago

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:

  1. Ensure you have Node.js installed on your system.
  2. Open a terminal and navigate to the project directory.
  3. Install dependencies by running:
  4. 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 application
    • Book.ts: Defines the Book class
    • Customer.ts: Defines the Customer class
    • Bookstore.ts: Implements the Bookstore functionality
    • index.ts: Main entry point of the application
  • test/: Contains Jest test files
    • addBook.test.ts
    • borrowBook.test.ts
    • returnBook.test.ts
  • package.json: Project configuration and dependencies
  • tsconfig.json: TypeScript configuration
  • jest.config.js: Jest configuration for TypeScript
1.0.0

9 months ago