This is a simple checkout system built with React and TypeScript. It allows users to add items to a basket, view the total price with any applicable special offers, and clear the basket.
- Add items to the basket.
- View the running total, including special offers.
- Clear the basket at any time.
- Calculations account for unit prices and special offer pricing.
-
Clone the repository:
git clone https://github.com/Emilybrown245/checkout-system.git
-
Navigate into the project folder
cd checkout-system
-
Install dependencies:
This project uses
npm
as a package manager.npm install
-
Required Node.js Version:
To run this project, you need Node.js v14.x or higher. You can check your Node.js version by running:
node -v
If you need to install or update Node.js, you can download the latest version from the official Node.js website.
This project uses Jest to run tests.
-
To run the tests, use the following command:
npm run test
This will run the Jest test suite and display the results in the terminal.
-
Run the development server:
npm run dev
This will start the development server, where you can view the application
-
Add Items to the Basket:
- Click on the item buttons (A, B, C, D) to add items to the basket.
-
View Total:
- The total price will be displayed, including any applicable special offers.
-
Clear Basket:
- Click the "Clear Basket" button to reset the basket and total.
- Item A:
- Unit Price: £0.50
- Special Offer: Buy 3 for £1.30
- Item B:
- Unit Price: £0.30
- Special Offer: Buy 2 for £0.45
- Item C:
- Unit Price: £0.20
- Item D:
- Unit Price: £0.15
-
React: JavaScript library for building user interfaces.
-
TypeScript: Superset of JavaScript for adding static types.
-
CSS: For basic styling of components.