package: update to typeforce 1.8.7

This commit is contained in:
Daniel Cousens 2016-09-30 16:25:13 +10:00
parent 4ae06003c4
commit b91cfcf196
7 changed files with 28 additions and 46 deletions

View file

@ -27,18 +27,23 @@ describe('types', 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))
assert.doesNotThrow(function () {
typeforce(types.oneOf(types.Hash160bit, types.Hash256bit), buffer32byte)
})
assert.doesNotThrow(function () {
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/)
}, /Expected Buffer\(Length: 20\), got Buffer\(Length: 32\)/)
assert.throws(function () {
types.Hash256bit(buffer20byte)
}, /Expected 256-bit Buffer, got 160-bit Buffer/)
}, /Expected Buffer\(Length: 32\), got Buffer\(Length: 20\)/)
})
})
})