tests: use safe-buffers throughout
This commit is contained in:
parent
aeb0312d63
commit
f1ab151c31
20 changed files with 88 additions and 94 deletions
test
|
@ -22,7 +22,7 @@ describe('ECSignature', function () {
|
|||
describe('parseCompact', function () {
|
||||
fixtures.valid.forEach(function (f) {
|
||||
it('imports ' + f.compact.hex + ' correctly', function () {
|
||||
var buffer = new Buffer(f.compact.hex, 'hex')
|
||||
var buffer = Buffer.from(f.compact.hex, 'hex')
|
||||
var parsed = ECSignature.parseCompact(buffer)
|
||||
|
||||
assert.strictEqual(parsed.compressed, f.compact.compressed)
|
||||
|
@ -34,7 +34,7 @@ describe('ECSignature', function () {
|
|||
|
||||
fixtures.invalid.compact.forEach(function (f) {
|
||||
it('throws on ' + f.hex, function () {
|
||||
var buffer = new Buffer(f.hex, 'hex')
|
||||
var buffer = Buffer.from(f.hex, 'hex')
|
||||
|
||||
assert.throws(function () {
|
||||
ECSignature.parseCompact(buffer)
|
||||
|
@ -57,7 +57,7 @@ describe('ECSignature', function () {
|
|||
describe('fromDER', function () {
|
||||
fixtures.valid.forEach(function (f) {
|
||||
it('imports ' + f.DER + ' correctly', function () {
|
||||
var buffer = new Buffer(f.DER, 'hex')
|
||||
var buffer = Buffer.from(f.DER, 'hex')
|
||||
var signature = ECSignature.fromDER(buffer)
|
||||
|
||||
assert.strictEqual(signature.r.toString(), f.signature.r)
|
||||
|
@ -67,7 +67,7 @@ describe('ECSignature', function () {
|
|||
|
||||
fixtures.invalid.DER.forEach(function (f) {
|
||||
it('throws "' + f.exception + '" for ' + f.hex, function () {
|
||||
var buffer = new Buffer(f.hex, 'hex')
|
||||
var buffer = Buffer.from(f.hex, 'hex')
|
||||
|
||||
assert.throws(function () {
|
||||
ECSignature.fromDER(buffer)
|
||||
|
@ -100,7 +100,7 @@ describe('ECSignature', function () {
|
|||
describe('parseScriptSignature', function () {
|
||||
fixtures.valid.forEach(function (f) {
|
||||
it('imports ' + f.scriptSignature.hex + ' correctly', function () {
|
||||
var buffer = new Buffer(f.scriptSignature.hex, 'hex')
|
||||
var buffer = Buffer.from(f.scriptSignature.hex, 'hex')
|
||||
var parsed = ECSignature.parseScriptSignature(buffer)
|
||||
|
||||
assert.strictEqual(parsed.signature.r.toString(), f.signature.r)
|
||||
|
@ -111,7 +111,7 @@ describe('ECSignature', function () {
|
|||
|
||||
fixtures.invalid.scriptSignature.forEach(function (f) {
|
||||
it('throws on ' + f.hex, function () {
|
||||
var buffer = new Buffer(f.hex, 'hex')
|
||||
var buffer = Buffer.from(f.hex, 'hex')
|
||||
|
||||
assert.throws(function () {
|
||||
ECSignature.parseScriptSignature(buffer)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue