tests: fix standard error, reword descriptions

This commit is contained in:
Daniel Cousens 2016-02-05 14:15:23 +11:00
parent 7c7537fc57
commit 1771067dfc

View file

@ -21,12 +21,17 @@ describe('types', function () {
var buffer20byte = new Buffer((new Array(20 + 1)).join('00'), 'hex')
var buffer32byte = new Buffer((new Array(32 + 1)).join('00'), 'hex')
it('return true for correct size', function () {
it('return true for valid size', function () {
assert(types.Hash160bit(buffer20byte))
assert(types.Hash256bit(buffer32byte))
})
it('throws for incorrect size', function () {
it('return true for oneOf', function () {
assert(typeforce(types.oneOf(types.Hash160bit, types.Hash256bit), buffer32byte))
assert(typeforce(types.oneOf(types.Hash256bit, types.Hash160bit), buffer32byte))
})
it('throws for invalid size', function () {
assert.throws(function () {
types.Hash160bit(buffer32byte)
}, /Expected 160-bit Buffer, got 256-bit Buffer/)
@ -35,10 +40,5 @@ describe('types', function () {
types.Hash256bit(buffer20byte)
}, /Expected 256-bit Buffer, got 160-bit Buffer/)
})
it('return true for oneOf', function () {
assert(typeforce(types.oneOf(types.Hash256bit, types.Hash160bit), buffer32byte), "Hash256 first")
assert(typeforce(types.oneOf(types.Hash160bit, types.Hash256bit), buffer32byte), "Hash160 first")
})
})
})