Features
- Book and customer registration
- Lookup by ID
- Loans with availability checks
- Returns with customer checks
PROGRAMMING · TYPESCRIPT · TESTING
A TypeScript library management system with reliable lending rules, automated tests and continuous integration.
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.`;
}// 01 · 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
// QUALITY
A book is lent only if available and returned only if the customer has it, with clear success or error messages.
Unit tests for adding, borrowing and returning books that check both the response and the final state.
Tests run on both the TypeScript code and the compiled JavaScript, ensuring the final build behaves the same way.
GitHub Actions runs the tests on every push and pull request, caches dependencies and keeps the coverage report.
// TESTS
$ 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
Need a reliable system for your business?
I build software with automated tests so every change reaches production safely.