Template for Checkout KATA
Your task!
Let’s implement the code for a supermarket checkout that calculates the total price of a number of items. In a normal supermarket, things are identified using Stock Keeping Units, or SKUs. In our store, we’ll use individual letters of the alphabet (A, B, C, and so on). Our goods are priced individually. In addition, some items are multipriced: buy n of them, and they’ll cost you y cents. For example, item ‘A’ might cost 50 cents individually, but this week we have a special offer: buy three ‘A’s and they’ll cost you $1.30. In fact this week’s prices are:
A 50 3 for 130
B 30 2 for 45
C 20
D 15
Our checkout accepts items in any order, so that if we scan a B, an A, and another B, we’ll recognize the two B’s and price them at 45 (for a total price so far of 95). Because the pricing changes frequently, we need to be able to pass in a set of pricing rules each time we start handling a checkout transaction.
To begin your work checkout repository and run npm install. Set javascript language level to "flow" in Intellij.
To run tests enter command: npm run test
COMPETITION
Your team is gathering one point for use of every listed below good practice:
SOLID:
Single Responsibility Principle
Open Closed Principle
Liskov Substitution Principle
Interface Segregation Principle
Dependency Inversion principle
CLEAN CODE
Law of Demeter (train wrecks)
Domain Naming
GRASP
controller
Creator
High cohesion
Indirection
Information expert
Low coupling
Polymorphism
Protected Variations
Pure fabrication
GOF DESIGN PATTERNS
Builder pattern
Factory method pattern
Adapter
Bridge
Composite
Decorator
Facade
Flyweight
Proxy
Chain of responsibility
Command
Interpreter
Mediator
Memento
Observer
State
Strategy
Template method
Visitor