Skip to content

Latest commit

 

History

History
36 lines (22 loc) · 658 Bytes

README.md

File metadata and controls

36 lines (22 loc) · 658 Bytes

Cash Withdrawal

A project to study testing with jest.

Add the valid notes, a value to receive and the application returns the correct bills amount.


Installation and usage

Requires nodejs and yarn installed

Clone the repo and run yarn install

To build run yarn build

To test run yarn test


Example

import { Withdrawal } from './index'

const notes = [2, 5, 10, 20, 50, 100]
const withdrawal = new Withdrawal(notes)

const array = withdrawal.toArray(150)
console.log(array)
// [100, 50]

const map = withdrawal.toMap(150)
console.log(map)
// { 100: 1, 50: 1 }