commit
9f8b8c71dd
3 changed files with 31 additions and 45 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1,2 +1,3 @@
|
||||||
coverage
|
coverage
|
||||||
node_modules
|
node_modules
|
||||||
|
.nyc_output
|
||||||
|
|
23
package.json
23
package.json
|
@ -32,8 +32,8 @@
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"coverage": "mocha --require blanket -R travis-cov",
|
"coverage-report": "nyc report --reporter=lcov",
|
||||||
"coverage-local": "mocha --require blanket -R html-cov",
|
"coverage": "nyc --check-coverage --branches 90 --functions 90 mocha",
|
||||||
"integration": "mocha test/integration/",
|
"integration": "mocha test/integration/",
|
||||||
"prepublish": "npm run test",
|
"prepublish": "npm run test",
|
||||||
"standard": "standard",
|
"standard": "standard",
|
||||||
|
@ -47,20 +47,6 @@
|
||||||
"files": [
|
"files": [
|
||||||
"src"
|
"src"
|
||||||
],
|
],
|
||||||
"config": {
|
|
||||||
"blanket": {
|
|
||||||
"pattern": [
|
|
||||||
""
|
|
||||||
],
|
|
||||||
"data-cover-never": [
|
|
||||||
"node_modules",
|
|
||||||
"test"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"travis-cov": {
|
|
||||||
"threshold": 99
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"bigi": "^1.4.0",
|
"bigi": "^1.4.0",
|
||||||
"bip66": "^1.1.0",
|
"bip66": "^1.1.0",
|
||||||
|
@ -77,17 +63,16 @@
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"async": "^1.5.0",
|
"async": "^1.5.0",
|
||||||
"blanket": "^1.1.0",
|
|
||||||
"browserify": "^10.0.0",
|
"browserify": "^10.0.0",
|
||||||
"bs58": "^2.0.1",
|
"bs58": "^2.0.1",
|
||||||
"cb-http-client": "^0.2.0",
|
"cb-http-client": "^0.2.0",
|
||||||
"httpify": "^1.0.0",
|
"httpify": "^1.0.0",
|
||||||
"minimaldata": "^1.0.0",
|
"minimaldata": "^1.0.0",
|
||||||
"mocha": "^2.2.0",
|
"mocha": "^2.2.0",
|
||||||
|
"nyc": "^8.1.0",
|
||||||
"proxyquire": "^1.4.0",
|
"proxyquire": "^1.4.0",
|
||||||
"sinon": "^1.12.2",
|
"sinon": "^1.12.2",
|
||||||
"standard": "^5.0.0",
|
"standard": "^8.0.0"
|
||||||
"travis-cov": "^0.2.0"
|
|
||||||
},
|
},
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,19 +4,19 @@ var assert = require('assert')
|
||||||
var base58 = require('bs58')
|
var base58 = require('bs58')
|
||||||
var bitcoin = require('../')
|
var bitcoin = require('../')
|
||||||
|
|
||||||
var base58_encode_decode = require('./fixtures/core/base58_encode_decode.json')
|
var base58EncodeDecode = require('./fixtures/core/base58_encode_decode.json')
|
||||||
var base58_keys_invalid = require('./fixtures/core/base58_keys_invalid.json')
|
var base58KeysInvalid = require('./fixtures/core/base58_keys_invalid.json')
|
||||||
var base58_keys_valid = require('./fixtures/core/base58_keys_valid.json')
|
var base58KeysValid = require('./fixtures/core/base58_keys_valid.json')
|
||||||
var blocks_valid = require('./fixtures/core/blocks.json')
|
var blocksValid = require('./fixtures/core/blocks.json')
|
||||||
var sig_canonical = require('./fixtures/core/sig_canonical.json')
|
var sigCanonical = require('./fixtures/core/sig_canonical.json')
|
||||||
var sig_noncanonical = require('./fixtures/core/sig_noncanonical.json')
|
var sigHash = require('./fixtures/core/sighash.json')
|
||||||
var sighash = require('./fixtures/core/sighash.json')
|
var sigNoncanonical = require('./fixtures/core/sig_noncanonical.json')
|
||||||
var tx_valid = require('./fixtures/core/tx_valid.json')
|
var txValid = require('./fixtures/core/tx_valid.json')
|
||||||
|
|
||||||
describe('Bitcoin-core', function () {
|
describe('Bitcoin-core', function () {
|
||||||
// base58_encode_decode
|
// base58EncodeDecode
|
||||||
describe('base58', function () {
|
describe('base58', function () {
|
||||||
base58_encode_decode.forEach(function (f) {
|
base58EncodeDecode.forEach(function (f) {
|
||||||
var fhex = f[0]
|
var fhex = f[0]
|
||||||
var fb58 = f[1]
|
var fb58 = f[1]
|
||||||
|
|
||||||
|
@ -36,14 +36,14 @@ describe('Bitcoin-core', function () {
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
// base58_keys_valid
|
// base58KeysValid
|
||||||
describe('address.toBase58Check', function () {
|
describe('address.toBase58Check', function () {
|
||||||
var typeMap = {
|
var typeMap = {
|
||||||
'pubkey': 'pubKeyHash',
|
'pubkey': 'pubKeyHash',
|
||||||
'script': 'scriptHash'
|
'script': 'scriptHash'
|
||||||
}
|
}
|
||||||
|
|
||||||
base58_keys_valid.forEach(function (f) {
|
base58KeysValid.forEach(function (f) {
|
||||||
var expected = f[0]
|
var expected = f[0]
|
||||||
var hash = new Buffer(f[1], 'hex')
|
var hash = new Buffer(f[1], 'hex')
|
||||||
var params = f[2]
|
var params = f[2]
|
||||||
|
@ -59,7 +59,7 @@ describe('Bitcoin-core', function () {
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
// base58_keys_invalid
|
// base58KeysInvalid
|
||||||
describe('address.fromBase58Check', function () {
|
describe('address.fromBase58Check', function () {
|
||||||
var allowedNetworks = [
|
var allowedNetworks = [
|
||||||
bitcoin.networks.bitcoin.pubkeyhash,
|
bitcoin.networks.bitcoin.pubkeyhash,
|
||||||
|
@ -68,7 +68,7 @@ describe('Bitcoin-core', function () {
|
||||||
bitcoin.networks.testnet.scripthash
|
bitcoin.networks.testnet.scripthash
|
||||||
]
|
]
|
||||||
|
|
||||||
base58_keys_invalid.forEach(function (f) {
|
base58KeysInvalid.forEach(function (f) {
|
||||||
var string = f[0]
|
var string = f[0]
|
||||||
|
|
||||||
it('throws on ' + string, function () {
|
it('throws on ' + string, function () {
|
||||||
|
@ -81,9 +81,9 @@ describe('Bitcoin-core', function () {
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
// base58_keys_valid
|
// base58KeysValid
|
||||||
describe('ECPair', function () {
|
describe('ECPair', function () {
|
||||||
base58_keys_valid.forEach(function (f) {
|
base58KeysValid.forEach(function (f) {
|
||||||
var string = f[0]
|
var string = f[0]
|
||||||
var hex = f[1]
|
var hex = f[1]
|
||||||
var params = f[2]
|
var params = f[2]
|
||||||
|
@ -104,14 +104,14 @@ describe('Bitcoin-core', function () {
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
// base58_keys_invalid
|
// base58KeysInvalid
|
||||||
describe('ECPair.fromWIF', function () {
|
describe('ECPair.fromWIF', function () {
|
||||||
var allowedNetworks = [
|
var allowedNetworks = [
|
||||||
bitcoin.networks.bitcoin,
|
bitcoin.networks.bitcoin,
|
||||||
bitcoin.networks.testnet
|
bitcoin.networks.testnet
|
||||||
]
|
]
|
||||||
|
|
||||||
base58_keys_invalid.forEach(function (f) {
|
base58KeysInvalid.forEach(function (f) {
|
||||||
var string = f[0]
|
var string = f[0]
|
||||||
|
|
||||||
it('throws on ' + string, function () {
|
it('throws on ' + string, function () {
|
||||||
|
@ -123,7 +123,7 @@ describe('Bitcoin-core', function () {
|
||||||
})
|
})
|
||||||
|
|
||||||
describe('Block.fromHex', function () {
|
describe('Block.fromHex', function () {
|
||||||
blocks_valid.forEach(function (f) {
|
blocksValid.forEach(function (f) {
|
||||||
it('can parse ' + f.id, function () {
|
it('can parse ' + f.id, function () {
|
||||||
var block = bitcoin.Block.fromHex(f.hex)
|
var block = bitcoin.Block.fromHex(f.hex)
|
||||||
|
|
||||||
|
@ -133,9 +133,9 @@ describe('Bitcoin-core', function () {
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
// tx_valid
|
// txValid
|
||||||
describe('Transaction.fromHex', function () {
|
describe('Transaction.fromHex', function () {
|
||||||
tx_valid.forEach(function (f) {
|
txValid.forEach(function (f) {
|
||||||
// Objects that are only a single string are ignored
|
// Objects that are only a single string are ignored
|
||||||
if (f.length === 1) return
|
if (f.length === 1) return
|
||||||
|
|
||||||
|
@ -163,7 +163,7 @@ describe('Bitcoin-core', function () {
|
||||||
})
|
})
|
||||||
|
|
||||||
describe('script.fromASM', function () {
|
describe('script.fromASM', function () {
|
||||||
tx_valid.forEach(function (f) {
|
txValid.forEach(function (f) {
|
||||||
// Objects that are only a single string are ignored
|
// Objects that are only a single string are ignored
|
||||||
if (f.length === 1) return
|
if (f.length === 1) return
|
||||||
|
|
||||||
|
@ -193,7 +193,7 @@ describe('Bitcoin-core', function () {
|
||||||
|
|
||||||
// sighash
|
// sighash
|
||||||
describe('Transaction', function () {
|
describe('Transaction', function () {
|
||||||
sighash.forEach(function (f) {
|
sigHash.forEach(function (f) {
|
||||||
// Objects that are only a single string are ignored
|
// Objects that are only a single string are ignored
|
||||||
if (f.length === 1) return
|
if (f.length === 1) return
|
||||||
|
|
||||||
|
@ -228,7 +228,7 @@ describe('Bitcoin-core', function () {
|
||||||
})
|
})
|
||||||
|
|
||||||
describe('ECSignature.parseScriptSignature', function () {
|
describe('ECSignature.parseScriptSignature', function () {
|
||||||
sig_canonical.forEach(function (hex) {
|
sigCanonical.forEach(function (hex) {
|
||||||
var buffer = new Buffer(hex, 'hex')
|
var buffer = new Buffer(hex, 'hex')
|
||||||
|
|
||||||
it('can parse ' + hex, function () {
|
it('can parse ' + hex, function () {
|
||||||
|
@ -238,11 +238,11 @@ describe('Bitcoin-core', function () {
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
sig_noncanonical.forEach(function (hex, i) {
|
sigNoncanonical.forEach(function (hex, i) {
|
||||||
if (i === 0) return
|
if (i === 0) return
|
||||||
if (i % 2 !== 0) return
|
if (i % 2 !== 0) return
|
||||||
|
|
||||||
var description = sig_noncanonical[i - 1].slice(0, -1)
|
var description = sigNoncanonical[i - 1].slice(0, -1)
|
||||||
var buffer = new Buffer(hex, 'hex')
|
var buffer = new Buffer(hex, 'hex')
|
||||||
|
|
||||||
it('throws on ' + description, function () {
|
it('throws on ' + description, function () {
|
||||||
|
|
Loading…
Add table
Reference in a new issue