Ensure encode throws an error if receiving anything else than a integer

This commit is contained in:
2012-04-19 23:09:10 +01:00
parent 04918a627c
commit 0dbaf8676d
2 changed files with 8 additions and 2 deletions

View File

@@ -10,9 +10,15 @@ describe 'Base58', ->
for str, num of examples
Base58.encode(num).should.eql(str)
describe 'when passed a float', ->
it 'throws an error', ->
(-> Base58.encode(3.14)).should
.throw('Value passed is not an integer.')
describe 'when passed a non-number value', ->
it 'throws an error', ->
(-> Base58.encode('hi')).should.throw('Value passed is not a number.')
(-> Base58.encode('hi')).should
.throw('Value passed is not an integer.')
describe '.decode', ->
it 'decodes Base58 string to number', ->