https://github.com/nbaztec/exercise-cart-checkout
Simple coding execise
https://github.com/nbaztec/exercise-cart-checkout
Last synced: about 1 year ago
JSON representation
Simple coding execise
- Host: GitHub
- URL: https://github.com/nbaztec/exercise-cart-checkout
- Owner: nbaztec
- Created: 2017-05-19T13:46:05.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2017-05-19T14:02:12.000Z (about 9 years ago)
- Last Synced: 2025-02-04T17:28:20.615Z (over 1 year ago)
- Language: JavaScript
- Size: 6.84 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## Exercise - Cart Checkout Calculator
Calculates the total price based on the cart and multiple offers applied to each item.
### Example
If the inventory consists of 2 items:
* Beer, EUR 5 (Offers: 2 for EUR 6, 6 for EUR 20)
* Water, EUR 2 (Offers: 5 for EUR 8)
And the cart looks like:
* Beer x 10
* Water x 6
Then the total should be:
* Beer: 6 for EUR 20 + 4 for EUR 12 (EUR 6 per 2 units)
* Water: 5 for EUR 8 + 1 for EUR 2
So the total comes out to be: **EUR 42**
### Install
```
npm install
```
### Start
Update the item, offers & inventory mocks within the `mocks/` directory. Then run `index.js`.
```
npm start
```
### Test
```
npm test
```
### Coverage
```
npm run test-coverage
```
Tip: 100% test coverage