simple js impl of price calculator with tests