diff --git a/test/types.js b/test/types.js index 94a174e..5bbf7e3 100644 --- a/test/types.js +++ b/test/types.js @@ -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") - }) }) })