snigo
1
Last test case:
This is incorrect:
{status: "CLOSED", change: [["PENNY", 0.5], ["NICKEL", 0], ["DIME", 0], ["QUARTER", 0], ["ONE", 0], ["FIVE", 0], ["TEN", 0], ["TWENTY", 0], ["ONE HUNDRED", 0]]}
Should be:
{status: "CLOSED", change: [["PENNY", 0.5]]}
snigo
3
Then you have incorrect assertions in all ‘OPEN’ cases as they do not require all of the denominations
The challenge wants you to take care of three circumstances.
-
When you have enough money to give back the change and have money left in your drawer
even after paying the change.
For this instructions say,
Return {status: "OPEN", change: [...]}
, with the change due in coins and bills, sorted in highest to lowest order, as the value of the change
key.
-
When total money in your drawer is equal to amount you have to pay in change.
Instructions in the challenge say following for it.
Return {status: "CLOSED", change: [...]}
with cash-in-drawer as the value for the key change
if it is equal to the change due.
- And,finally, when cash in your drawer is not enough to pay the change.
This is instruction for that:
Return {status: "INSUFFICIENT_FUNDS", change: []}
if cash-in-drawer is less than the change due, or if you cannot return the exact change.
Does that clear your confusion?
snigo
5
Changing the type of output for the same property makes absolutely no sense to me, therefore my brain must have TLDRed it