diff --git a/script/helpers.coffee b/script/helpers.coffee index e4fdc2b65d..b5fbdf330f 100644 --- a/script/helpers.coffee +++ b/script/helpers.coffee @@ -269,7 +269,7 @@ module.exports = ### silver: (num) -> if num - Math.floor (num - Math.floor(num))*100 + ("0" + Math.floor (num - Math.floor(num))*100).slice -2 else return "00" diff --git a/tests/algos.mocha.coffee b/tests/algos.mocha.coffee index 915c1f40bc..779ac9ac78 100644 --- a/tests/algos.mocha.coffee +++ b/tests/algos.mocha.coffee @@ -251,4 +251,5 @@ describe 'Helper', -> it 'calculates silver coins', -> expect(helpers.silver(10)).to.eql 0 expect(helpers.silver(1.957)).to.eql 95 - expect(helpers.silver()).to.eql 0 + expect(helpers.silver(0.01)).to.eql "01" + expect(helpers.silver()).to.eql "00"