Skip to content

Latest commit

 

History

History
64 lines (42 loc) · 3.07 KB

README.md

File metadata and controls

64 lines (42 loc) · 3.07 KB

Tolling System App

Overview

The Tolling System App is designed to manage toll transactions efficiently. This app allows you to add, update, and query toll transactions in a SQLite database. The backend logic is tested using Cypress, ensuring robust and reliable database operations.

This repository contains a mock backend system for managing toll transactions. It includes functionality for adding, querying, updating toll transactions in a SQLite database, and streaming toll transaction data. End-to-end tests are implemented using Cypress.

This app uses SQL.js which operates entirely within the browser, using WebAssembly to execute SQLite queries without any need for backend interaction. It is a powerful tool for running lightweight, client-side SQL databases but is limited to the scope of what can be done within the browser environment. All data processing is done locally, and if you need to persist data across sessions, you must manually handle it by saving the database state to a file or browser storage like IndexedDB.

Features

  • Add Toll Transactions: Add new toll transactions with vehicle ID, toll booth ID, and amount paid.
  • Update Toll Transactions: Modify existing toll transactions.
  • Query Toll Transactions: Retrieve specific or all toll transactions.
  • Get Next ID: Fetch the next available ID for toll transactions.
  • Database Initialization: Ensure that the toll transactions table is created in the database if it doesn't already exist.

Technologies Used

  • Node.js: Runtime environment for running JavaScript code on the server.
  • TypeScript: Typed superset of JavaScript that compiles to plain JavaScript, ensuring type safety and better code quality.
  • Cypress: Testing framework used for end-to-end testing of the app's backend logic.
  • SQLite3: Lightweight, disk-based database that doesn’t require a separate server process, used for storing toll transactions.
  • Zsh: Shell used for managing the development environment.
  • NVM (Node Version Manager): Manages multiple Node.js versions.
  • Oh My Zsh: Framework for managing your Zsh configuration.

Prerequisites

  • Node.js (v18.x.x): Ensure Node.js is installed. You can manage versions using NVM.
  • npm: Comes with Node.js for managing packages.
  • SQLite3: Ensure you have SQLite3 installed.

Installation

  1. Clone the repository:
    git clone https://github.com/your-repo/tolling-system-app.git
    cd tolling-system-app
    

Usage

Running the App

App:

npm start

Tests:

Since the app is designed primarily for backend operations and testing, it doesn't have a traditional "run" command. Instead, you'll interact with the database through Cypress tasks and tests.

Testing the App [testing is in progress]

  1. Open Cypress:

    bash npx cypress open

  2. Run Tests:

    • From the Cypress UI, select the desired test file (e.g., add-toll-transaction.cy.ts) and click to run it.
    • The tests will perform various operations like adding, updating, querying, and retrieving the next ID from the database.