PROGRAMMING · TYPESCRIPT · TESTING

Library Management

A TypeScript library management system with reliable lending rules, automated tests and continuous integration.

src/services/Bookstore.ts
borrowBook(customerId: number, bookId: number): string {
    const customer = this.findCustomerById(customerId);
    const book = this.findBookById(bookId);

    if (customer && book && book.available) {
      customer.borrowBook(bookId);
      book.toggleAvailability();
      return `${customer.name} successfully borrowed "${book.title}".`;
    }
    return `Borrowing failed.`;
}
Program
Computer Programmer program · Lambton College
Year
2024
Role
Developer
Quality
Jest tests + continuous integration

// 01 · THE MISSION

The mission

Library Management simulates a library's operations: registering books and customers, loans and returns. The main challenge was ensuring the system never reaches an inconsistent state—for example, lending a book that is already on loan or accepting the return of a book the customer does not have. To achieve this I applied object-oriented programming, covered every operation with Jest unit tests and set up GitHub Actions so the tests run automatically on every change. Developed within the Computer Programmer program at Lambton College in Ontario, Canada, following professional standards for development, documentation and version control.

// WHAT WAS BUILT

Features

  • Book and customer registration
  • Lookup by ID
  • Loans with availability checks
  • Returns with customer checks

Architecture

  • Book and Customer models
  • Bookstore service with the business logic
  • TypeScript compiled to JavaScript in dist/

// QUALITY

How it is guaranteed to work

01

Clear business rules

A book is lent only if available and returned only if the customer has it, with clear success or error messages.

02

Tests for every operation

Unit tests for adding, borrowing and returning books that check both the response and the final state.

03

Source and compiled code

Tests run on both the TypeScript code and the compiled JavaScript, ensuring the final build behaves the same way.

04

Continuous integration

GitHub Actions runs the tests on every push and pull request, caches dependencies and keeps the coverage report.

// TESTS

All tests passing

npm test
$ npm test

 PASS  src/tests/addBook.test.ts
 PASS  src/tests/borrowBook.test.ts
 PASS  src/tests/returnBook.test.ts
 PASS  dist/tests/addBook.test.js
 PASS  dist/tests/borrowBook.test.js
 PASS  dist/tests/returnBook.test.js

Test Suites: 6 passed, 6 total
Tests:       6 passed, 6 total

Result recorded in the repository (results.txt).

MISSION ACCOMPLISHED

Results and impact

Need a reliable system for your business?

I build software with automated tests so every change reaches production safely.