|
@ -46,4 +46,19 @@ describe('types', function () { |
|
|
}, /Expected Buffer\(Length: 32\), got Buffer\(Length: 20\)/) |
|
|
}, /Expected Buffer\(Length: 32\), got Buffer\(Length: 20\)/) |
|
|
}) |
|
|
}) |
|
|
}) |
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
describe('Satoshi', function () { |
|
|
|
|
|
[ |
|
|
|
|
|
{ value: -1, result: false }, |
|
|
|
|
|
{ value: 0, result: true }, |
|
|
|
|
|
{ value: 1, result: true }, |
|
|
|
|
|
{ value: 20999999 * 1e8, result: true }, |
|
|
|
|
|
{ value: 21000000 * 1e8, result: true }, |
|
|
|
|
|
{ value: 21000001 * 1e8, result: false } |
|
|
|
|
|
].forEach(function (f) { |
|
|
|
|
|
it('returns ' + f.result + ' for valid for ' + f.value, function () { |
|
|
|
|
|
assert.strictEqual(types.Satoshi(f.value), f.result) |
|
|
|
|
|
}) |
|
|
|
|
|
}) |
|
|
|
|
|
}) |
|
|
}) |
|
|
}) |
|
|