From b2351f90262e95f49dc90b0fe7002247310ee41a Mon Sep 17 00:00:00 2001 From: Daniel Cousens Date: Sun, 18 May 2014 19:47:39 +1000 Subject: [PATCH] tests: use JSON fixtures exclusively --- test/address.js | 4 +- test/base58.js | 8 ++- test/base58check.js | 3 +- test/bufferutils.js | 2 +- test/crypto.js | 2 +- test/ec.js | 2 +- test/ecdsa.js | 4 +- test/eckey.js | 2 +- test/ecpubkey.js | 2 +- test/fixtures/{address.js => address.json} | 4 +- test/fixtures/{base58.js => base58.json} | 2 +- .../{base58check.js => base58check.json} | 4 +- test/fixtures/{buffer.js => buffer.json} | 2 +- test/fixtures/crypto.js | 50 ----------------- test/fixtures/crypto.json | 50 +++++++++++++++++ test/fixtures/{ec.js => ec.json} | 2 +- test/fixtures/{ecdsa.js => ecdsa.json} | 2 +- test/fixtures/{eckey.js => eckey.json} | 4 +- test/fixtures/{ecpubkey.js => ecpubkey.json} | 4 +- test/fixtures/message.js | 19 ------- test/fixtures/message.json | 19 +++++++ test/fixtures/script.js | 54 ------------------- test/fixtures/script.json | 54 +++++++++++++++++++ test/fixtures/syncscript.js | 4 +- test/message.js | 2 +- test/script.js | 2 +- 26 files changed, 152 insertions(+), 155 deletions(-) rename test/fixtures/{address.js => address.json} (98%) rename test/fixtures/{base58.js => base58.json} (98%) rename test/fixtures/{base58check.js => base58check.json} (99%) rename test/fixtures/{buffer.js => buffer.json} (98%) delete mode 100644 test/fixtures/crypto.js create mode 100644 test/fixtures/crypto.json rename test/fixtures/{ec.js => ec.json} (99%) rename test/fixtures/{ecdsa.js => ecdsa.json} (99%) rename test/fixtures/{eckey.js => eckey.json} (99%) rename test/fixtures/{ecpubkey.js => ecpubkey.json} (97%) delete mode 100644 test/fixtures/message.js create mode 100644 test/fixtures/message.json delete mode 100644 test/fixtures/script.js create mode 100644 test/fixtures/script.json diff --git a/test/address.js b/test/address.js index 6475ebb..0384732 100644 --- a/test/address.js +++ b/test/address.js @@ -3,8 +3,8 @@ var Address = require('../src/address') var networks = require('../src/networks') var Script = require('../src/script') -var b58fixtures = require('./fixtures/base58') -var fixtures = require('./fixtures/address') +var b58fixtures = require('./fixtures/base58.json') +var fixtures = require('./fixtures/address.json') function h2b(h) { return new Buffer(h, 'hex') } diff --git a/test/base58.js b/test/base58.js index 206425b..603a88f 100644 --- a/test/base58.js +++ b/test/base58.js @@ -1,9 +1,7 @@ var assert = require('assert') var base58 = require('../src/base58') -var fixtures = require('./fixtures/base58') -function b2h(b) { return new Buffer(b).toString('hex') } -function h2b(h) { return new Buffer(h, 'hex') } +var fixtures = require('./fixtures/base58.json') describe('base58', function() { describe('decode', function() { @@ -12,7 +10,7 @@ describe('base58', function() { var actual = base58.decode(f.string) var expected = f.hex - assert.strictEqual(b2h(actual), expected) + assert.strictEqual(actual.toString('hex'), expected) }) }) @@ -28,7 +26,7 @@ describe('base58', function() { describe('encode', function() { it('can encode Bitcoin core test data', function() { fixtures.valid.forEach(function(f) { - var actual = base58.encode(h2b(f.hex)) + var actual = base58.encode(new Buffer(f.hex, 'hex')) var expected = f.string.trim() assert.strictEqual(actual, expected) diff --git a/test/base58check.js b/test/base58check.js index a4940be..b37db78 100644 --- a/test/base58check.js +++ b/test/base58check.js @@ -1,6 +1,7 @@ var assert = require('assert') var base58check = require('../src/base58check') -var fixtures = require('./fixtures/base58check') + +var fixtures = require('./fixtures/base58check.json') function b2h(b) { return new Buffer(b).toString('hex') } function h2b(h) { return new Buffer(h, 'hex') } diff --git a/test/bufferutils.js b/test/bufferutils.js index 382c8ff..97a4007 100644 --- a/test/bufferutils.js +++ b/test/bufferutils.js @@ -1,7 +1,7 @@ var assert = require('assert') var bufferutils = require('../src/bufferutils') -var fixtures = require('./fixtures/buffer.js') +var fixtures = require('./fixtures/buffer.json') describe('bufferutils', function() { describe('readUInt64LE', function() { diff --git a/test/crypto.js b/test/crypto.js index e5ca84e..361468d 100644 --- a/test/crypto.js +++ b/test/crypto.js @@ -1,7 +1,7 @@ var assert = require('assert') var crypto = require('../src/crypto') -var fixtures = require('./fixtures/crypto') +var fixtures = require('./fixtures/crypto.json') describe('Crypto', function() { describe('HASH160', function() { diff --git a/test/ec.js b/test/ec.js index f9aa100..a166bde 100644 --- a/test/ec.js +++ b/test/ec.js @@ -6,7 +6,7 @@ var ecparams = sec('secp256k1') var BigInteger = require('bigi') var ECPointFp = require('../src/ec').ECPointFp -var fixtures = require('./fixtures/ec.js') +var fixtures = require('./fixtures/ec.json') describe('ec', function() { describe('ECPointFp', function() { diff --git a/test/ecdsa.js b/test/ecdsa.js index 48ed5b8..8e53881 100644 --- a/test/ecdsa.js +++ b/test/ecdsa.js @@ -8,10 +8,8 @@ var sec = require('../src/sec') var ecparams = sec("secp256k1") var BigInteger = require('bigi') -var ECKey = require('../src/eckey') -var ECPubKey = require('../src/ecpubkey') -var fixtures = require('./fixtures/ecdsa.js') +var fixtures = require('./fixtures/ecdsa.json') describe('ecdsa', function() { describe('deterministicGenerateK', function() { diff --git a/test/eckey.js b/test/eckey.js index 9b4a696..80afec4 100644 --- a/test/eckey.js +++ b/test/eckey.js @@ -4,7 +4,7 @@ var crypto = require('../src/crypto') var BigInteger = require('bigi') var ECKey = require('../src/eckey') -var fixtures = require('./fixtures/eckey') +var fixtures = require('./fixtures/eckey.json') var networks = require('../src/networks') describe('ECKey', function() { diff --git a/test/ecpubkey.js b/test/ecpubkey.js index c7aefd8..00f51ff 100644 --- a/test/ecpubkey.js +++ b/test/ecpubkey.js @@ -7,7 +7,7 @@ var BigInteger = require('bigi') var ECPointFp = require('../src/ec').ECPointFp var ECPubKey = require('../src/ecpubkey') -var fixtures = require('./fixtures/ecpubkey') +var fixtures = require('./fixtures/ecpubkey.json') describe('ECPubKey', function() { var Q diff --git a/test/fixtures/address.js b/test/fixtures/address.json similarity index 98% rename from test/fixtures/address.js rename to test/fixtures/address.json index d9e351e..42e8f41 100644 --- a/test/fixtures/address.js +++ b/test/fixtures/address.json @@ -1,4 +1,4 @@ -module.exports = { +{ "valid": [ { "description": "pubKeyHash", @@ -42,4 +42,4 @@ module.exports = { } ] } -} \ No newline at end of file +} diff --git a/test/fixtures/base58.js b/test/fixtures/base58.json similarity index 98% rename from test/fixtures/base58.js rename to test/fixtures/base58.json index 761d446..a9b3705 100644 --- a/test/fixtures/base58.js +++ b/test/fixtures/base58.json @@ -1,4 +1,4 @@ -module.exports = { +{ "valid": [ { "hex": "", diff --git a/test/fixtures/base58check.js b/test/fixtures/base58check.json similarity index 99% rename from test/fixtures/base58check.js rename to test/fixtures/base58check.json index cf0781d..ef37f5f 100644 --- a/test/fixtures/base58check.js +++ b/test/fixtures/base58check.json @@ -1,4 +1,4 @@ -module.exports = { +{ "valid": [ { "string": "1AGNa15ZQXAZUgFiqJ2i7Z2DPU2J6hW62i", @@ -475,4 +475,4 @@ module.exports = { "Ky1YjoZNgQ196HJV3HpdkecfhRBmRZdMJk89Hi5KGfpfPwS2bUbfd", "2A1q1YsMZowabbvta7kTy2Fd6qN4r5ZCeG3qLpvZBMzCixMUdkN2Y4dHB1wPsZAeVXUGD83MfRED" ] -} \ No newline at end of file +} diff --git a/test/fixtures/buffer.js b/test/fixtures/buffer.json similarity index 98% rename from test/fixtures/buffer.js rename to test/fixtures/buffer.json index 7de5381..268a92d 100644 --- a/test/fixtures/buffer.js +++ b/test/fixtures/buffer.json @@ -1,4 +1,4 @@ -module.exports = { +{ "valid": [ { "dec": 0, diff --git a/test/fixtures/crypto.js b/test/fixtures/crypto.js deleted file mode 100644 index a89ac4a..0000000 --- a/test/fixtures/crypto.js +++ /dev/null @@ -1,50 +0,0 @@ -module.exports = { - before: { - secret: 'vires is numeris', - hex: [ - '0000000000000001', - '0101010101010101', - 'FFFFFFFFFFFFFFFF', - '4c6f72656d20697073756d20646f6c6f722073697420616d65742c20636f6e73656374657475722061646970697363696e6720656c69742e20446f6e65632061742066617563696275732073617069656e2c2076656c20666163696c6973697320617263752e20536564207574206d61737361206e6962682e205574206d6f6c6c69732070756c76696e6172206d617373612e20557420756c6c616d636f7270657220646f6c6f7220656e696d2c20696e206d6f6c657374696520656e696d20636f6e64696d656e74756d2061632e20416c697175616d206572617420766f6c75747061742e204e756c6c6120736f64616c657320617420647569206e656320' - ], - }, - - after: { - hash160: [ - 'cdb00698f02afd929ffabea308340fa99ac2afa8', - 'abaf1119f83e384210fe8e222eac76e2f0da39dc', - 'f86221f5a1fca059a865c0b7d374dfa9d5f3aeb4', - '9763e6b367c363bd6b88a7b361c98e6beee243a5' - ], - hash256: [ - '3ae5c198d17634e79059c2cd735491553d22c4e09d1d9fea3ecf214565df2284', - '728338d99f356175c4945ef5cccfa61b7b56143cbbf426ddd0e0fc7cfe8c3c23', - '752adad0a7b9ceca853768aebb6965eca126a62965f698a0c1bc43d83db632ad', - '033588797115feb3545052670cac2a46584ab3cb460de63756ee0275e66b5799' - ], - sha1: [ - 'cb473678976f425d6ec1339838f11011007ad27d', - 'c0357a32ed1f6a03be92dd094476f7f1a2e214ec', - 'be673e8a56eaa9d8c1d35064866701c11ef8e089', - '10d96fb43aca84e342206887bbeed3065d4e4344' - ], - sha256: [ - 'cd2662154e6d76b2b2b92e70c0cac3ccf534f9b74eb5b89819ec509083d00a50', - '04abc8821a06e5a30937967d11ad10221cb5ac3b5273e434f1284ee87129a061', - '12a3ae445661ce5dee78d0650d33362dec29c4f82af05e7e57fb595bbbacf0ca', - 'a7fb8276035057ed6479c5f2305a96da100ac43f0ac10f277e5ab8c5457429da' - ], - hmacsha256: [ - '73442dc8dd7f71a106a20fddd49d31856b1db12956c75070c8186b0b3eb71251', - '7204c72af7c73f5e84447a752dc8a2708f91b896f29de5fcf4b7f42f13a30c6e', - 'a03c2ac6e9ca86678b5608a3d8682de46d17026f5fac4fd7147d2e5022061833', - 'a780cd6e5c29cf11f756536ea5779992687c1b3b5e37f31b027a392d94e91fb8' - ], - hmacsha512: [ - '4c0595aed1f5d066ea9f797727c060eb86cb55ff29d4d4fd2cd0ad3a012386763aea604c030619c79aa7fd8d03cda1b73a9ebd17906a3d2a350108d1a98b24ac', - 'f80b90d63b804b3d2ab03b9bfb3ac94ee271352eb8bddfb6b4f5cf2a4fc9176acea35f517728e64943d1eb8af1e4674a114082c81bc8874d88b408b3b406d6a4', - '134cf60c30a5cd412c7a5cd6c3f878279e139b47c19550b7456fa137fbf90e580ae0a923a22052f42ec801ac658db32821e271161b563eac4926285ba6b8f410', - '7dee95aa3c462d3eb7ecb61536cb215e471d1fa73d8643a967905946e26c536588c5058abd5a049a22b987db95a7fb420f3bff12359dc53d03d7ce7df714e029' - ] - } -} diff --git a/test/fixtures/crypto.json b/test/fixtures/crypto.json new file mode 100644 index 0000000..2db8e2d --- /dev/null +++ b/test/fixtures/crypto.json @@ -0,0 +1,50 @@ +{ + "before": { + "secret": "vires is numeris", + "hex": [ + "0000000000000001", + "0101010101010101", + "FFFFFFFFFFFFFFFF", + "4c6f72656d20697073756d20646f6c6f722073697420616d65742c20636f6e73656374657475722061646970697363696e6720656c69742e20446f6e65632061742066617563696275732073617069656e2c2076656c20666163696c6973697320617263752e20536564207574206d61737361206e6962682e205574206d6f6c6c69732070756c76696e6172206d617373612e20557420756c6c616d636f7270657220646f6c6f7220656e696d2c20696e206d6f6c657374696520656e696d20636f6e64696d656e74756d2061632e20416c697175616d206572617420766f6c75747061742e204e756c6c6120736f64616c657320617420647569206e656320" + ] + }, + + "after": { + "hash160": [ + "cdb00698f02afd929ffabea308340fa99ac2afa8", + "abaf1119f83e384210fe8e222eac76e2f0da39dc", + "f86221f5a1fca059a865c0b7d374dfa9d5f3aeb4", + "9763e6b367c363bd6b88a7b361c98e6beee243a5" + ], + "hash256": [ + "3ae5c198d17634e79059c2cd735491553d22c4e09d1d9fea3ecf214565df2284", + "728338d99f356175c4945ef5cccfa61b7b56143cbbf426ddd0e0fc7cfe8c3c23", + "752adad0a7b9ceca853768aebb6965eca126a62965f698a0c1bc43d83db632ad", + "033588797115feb3545052670cac2a46584ab3cb460de63756ee0275e66b5799" + ], + "sha1": [ + "cb473678976f425d6ec1339838f11011007ad27d", + "c0357a32ed1f6a03be92dd094476f7f1a2e214ec", + "be673e8a56eaa9d8c1d35064866701c11ef8e089", + "10d96fb43aca84e342206887bbeed3065d4e4344" + ], + "sha256": [ + "cd2662154e6d76b2b2b92e70c0cac3ccf534f9b74eb5b89819ec509083d00a50", + "04abc8821a06e5a30937967d11ad10221cb5ac3b5273e434f1284ee87129a061", + "12a3ae445661ce5dee78d0650d33362dec29c4f82af05e7e57fb595bbbacf0ca", + "a7fb8276035057ed6479c5f2305a96da100ac43f0ac10f277e5ab8c5457429da" + ], + "hmacsha256": [ + "73442dc8dd7f71a106a20fddd49d31856b1db12956c75070c8186b0b3eb71251", + "7204c72af7c73f5e84447a752dc8a2708f91b896f29de5fcf4b7f42f13a30c6e", + "a03c2ac6e9ca86678b5608a3d8682de46d17026f5fac4fd7147d2e5022061833", + "a780cd6e5c29cf11f756536ea5779992687c1b3b5e37f31b027a392d94e91fb8" + ], + "hmacsha512": [ + "4c0595aed1f5d066ea9f797727c060eb86cb55ff29d4d4fd2cd0ad3a012386763aea604c030619c79aa7fd8d03cda1b73a9ebd17906a3d2a350108d1a98b24ac", + "f80b90d63b804b3d2ab03b9bfb3ac94ee271352eb8bddfb6b4f5cf2a4fc9176acea35f517728e64943d1eb8af1e4674a114082c81bc8874d88b408b3b406d6a4", + "134cf60c30a5cd412c7a5cd6c3f878279e139b47c19550b7456fa137fbf90e580ae0a923a22052f42ec801ac658db32821e271161b563eac4926285ba6b8f410", + "7dee95aa3c462d3eb7ecb61536cb215e471d1fa73d8643a967905946e26c536588c5058abd5a049a22b987db95a7fb420f3bff12359dc53d03d7ce7df714e029" + ] + } +} diff --git a/test/fixtures/ec.js b/test/fixtures/ec.json similarity index 99% rename from test/fixtures/ec.js rename to test/fixtures/ec.json index b7b973f..f4390ef 100644 --- a/test/fixtures/ec.js +++ b/test/fixtures/ec.json @@ -1,4 +1,4 @@ -module.exports = { +{ "valid": { "ECPointFp": [ { diff --git a/test/fixtures/ecdsa.js b/test/fixtures/ecdsa.json similarity index 99% rename from test/fixtures/ecdsa.js rename to test/fixtures/ecdsa.json index 6936dd1..d8b7f60 100644 --- a/test/fixtures/ecdsa.js +++ b/test/fixtures/ecdsa.json @@ -1,4 +1,4 @@ -module.exports = { +{ "valid": [ { "D": "0000000000000000000000000000000000000000000000000000000000000001", diff --git a/test/fixtures/eckey.js b/test/fixtures/eckey.json similarity index 99% rename from test/fixtures/eckey.js rename to test/fixtures/eckey.json index 1751ae8..11736ec 100644 --- a/test/fixtures/eckey.js +++ b/test/fixtures/eckey.json @@ -1,4 +1,4 @@ -module.exports = { +{ "valid": [ { "D": "1", @@ -95,4 +95,4 @@ module.exports = { } ] } -} \ No newline at end of file +} diff --git a/test/fixtures/ecpubkey.js b/test/fixtures/ecpubkey.json similarity index 97% rename from test/fixtures/ecpubkey.js rename to test/fixtures/ecpubkey.json index 77b9b42..87b8aa2 100644 --- a/test/fixtures/ecpubkey.js +++ b/test/fixtures/ecpubkey.json @@ -1,4 +1,4 @@ -module.exports = { +{ "Q": { "x": "55066263022277343669578718895168534326250603453777594175500187360389116729240", "y": "32670510020758816978083085130507043184471273380659243275938904335757337482424" @@ -16,4 +16,4 @@ module.exports = { "r": "68972263025625296948424563184904289678530916807200550828762374724416876919710", "s": "43478152510424186005054433052302509227777805602212468112169549534899266476898" } -} \ No newline at end of file +} diff --git a/test/fixtures/message.js b/test/fixtures/message.js deleted file mode 100644 index 756dcdd..0000000 --- a/test/fixtures/message.js +++ /dev/null @@ -1,19 +0,0 @@ -module.exports = { - magicHash: [ - { - network: 'bitcoin', - message: '', - magicHash: '80e795d4a4caadd7047af389d9f7f220562feb6196032e2131e10563352c4bcc' - }, - { - network: 'bitcoin', - message: 'Vires is Numeris', - magicHash: 'f8a5affbef4a3241b19067aa694562f64f513310817297089a8929a930f4f933' - }, - { - network: 'dogecoin', - message: 'Vires is Numeris', - magicHash: 'c0963d20d0accd0ea0df6c1020bf85a7e629a40e7b5363f2c3e9dcafd5638f12' - } - ] -} diff --git a/test/fixtures/message.json b/test/fixtures/message.json new file mode 100644 index 0000000..3db64c9 --- /dev/null +++ b/test/fixtures/message.json @@ -0,0 +1,19 @@ +{ + "magicHash": [ + { + "network": "bitcoin", + "message": "", + "magicHash": "80e795d4a4caadd7047af389d9f7f220562feb6196032e2131e10563352c4bcc" + }, + { + "network": "bitcoin", + "message": "Vires is Numeris", + "magicHash": "f8a5affbef4a3241b19067aa694562f64f513310817297089a8929a930f4f933" + }, + { + "network": "dogecoin", + "message": "Vires is Numeris", + "magicHash": "c0963d20d0accd0ea0df6c1020bf85a7e629a40e7b5363f2c3e9dcafd5638f12" + } + ] +} diff --git a/test/fixtures/script.js b/test/fixtures/script.js deleted file mode 100644 index 8fb5d21..0000000 --- a/test/fixtures/script.js +++ /dev/null @@ -1,54 +0,0 @@ -module.exports = { - valid: [ - { - description: 'P2SH ScriptPubKey', - hex: 'a914e8c300c87986efa84c37c0519929019ef86eb5b487', - type: 'scripthash', - hash: '0ba47b56a573bab4b430ad6ed3ec79270e04b066', - scriptPubKey: true - }, - { - description: 'PubKeyHash ScriptPubKey', - hex: '76a9145a3acbc7bbcc97c5ff16f5909c9d7d3fadb293a888ac', - type: 'pubkeyhash', - hash: 'a5313f33d5c7b81674b35f7f3febc3522ef234db', - scriptPubKey: true - }, - { - description: 'pubKeyHash scriptSig', - hex: '48304502206becda98cecf7a545d1a640221438ff8912d9b505ede67e0138485111099f696022100ccd616072501310acba10feb97cecc918e21c8e92760cd35144efec7622938f30141040cd2d2ce17a1e9b2b3b2cb294d40eecf305a25b7e7bfdafae6bb2639f4ee399b3637706c3d377ec4ab781355add443ae864b134c5e523001c442186ea60f0eb8', - type: 'pubkeyhash', - hash: 'b9bac2a5c5c29bb27c382d41fa3d179c646c78fd', - scriptPubKey: false - }, - { - description: 'Valid multisig script', - hex: '5121032487c2a32f7c8d57d2a93906a6457afd00697925b0e6e145d89af6d3bca330162102308673d16987eaa010e540901cc6fe3695e758c19f46ce604e174dac315e685a52ae', - type: 'multisig', - hash: 'f1c98f0b74ecabcf78ae20dfa224bb6666051fbe', - scriptPubKey: true - }, - { - description: 'OP_RETURN script', - hex:'6a2606deadbeef03f895a2ad89fb6d696497af486cb7c644a27aa568c7a18dd06113401115185474', - type: 'nulldata', - hash: 'ec88f016655477663455fe6a8e83508c348ea145', - scriptPubKey: true - }, - { - description: 'Non standard script', - hex: 'aa206fe28c0ab6f1b372c1a6a246ae63f74f931e8365e15a089c68d619000000000087', - type: 'nonstandard', - hash: '3823382e70d1930989813d3459988e0d7c2861d8', - scriptPubKey: true - }, - { - description: 'Invalid multisig script', - asm: '0 0 0 OP_CHECKmulTISIG', - hex: '000000ae', - type: 'nonstandard', - hash: '62ede8963f9387544935f168745262f703dab1fb', - scriptPubKey: true - } - ] -} diff --git a/test/fixtures/script.json b/test/fixtures/script.json new file mode 100644 index 0000000..17d2f64 --- /dev/null +++ b/test/fixtures/script.json @@ -0,0 +1,54 @@ +{ + "valid": [ + { + "description": "P2SH ScriptPubKey", + "hex": "a914e8c300c87986efa84c37c0519929019ef86eb5b487", + "type": "scripthash", + "hash": "0ba47b56a573bab4b430ad6ed3ec79270e04b066", + "scriptPubKey": true + }, + { + "description": "PubKeyHash ScriptPubKey", + "hex": "76a9145a3acbc7bbcc97c5ff16f5909c9d7d3fadb293a888ac", + "type": "pubkeyhash", + "hash": "a5313f33d5c7b81674b35f7f3febc3522ef234db", + "scriptPubKey": true + }, + { + "description": "pubKeyHash scriptSig", + "hex": "48304502206becda98cecf7a545d1a640221438ff8912d9b505ede67e0138485111099f696022100ccd616072501310acba10feb97cecc918e21c8e92760cd35144efec7622938f30141040cd2d2ce17a1e9b2b3b2cb294d40eecf305a25b7e7bfdafae6bb2639f4ee399b3637706c3d377ec4ab781355add443ae864b134c5e523001c442186ea60f0eb8", + "type": "pubkeyhash", + "hash": "b9bac2a5c5c29bb27c382d41fa3d179c646c78fd", + "scriptPubKey": false + }, + { + "description": "Valid multisig script", + "hex": "5121032487c2a32f7c8d57d2a93906a6457afd00697925b0e6e145d89af6d3bca330162102308673d16987eaa010e540901cc6fe3695e758c19f46ce604e174dac315e685a52ae", + "type": "multisig", + "hash": "f1c98f0b74ecabcf78ae20dfa224bb6666051fbe", + "scriptPubKey": true + }, + { + "description": "OP_RETURN script", + "hex":"6a2606deadbeef03f895a2ad89fb6d696497af486cb7c644a27aa568c7a18dd06113401115185474", + "type": "nulldata", + "hash": "ec88f016655477663455fe6a8e83508c348ea145", + "scriptPubKey": true + }, + { + "description": "Non standard script", + "hex": "aa206fe28c0ab6f1b372c1a6a246ae63f74f931e8365e15a089c68d619000000000087", + "type": "nonstandard", + "hash": "3823382e70d1930989813d3459988e0d7c2861d8", + "scriptPubKey": true + }, + { + "description": "Invalid multisig script", + "asm": "0 0 0 OP_CHECKmulTISIG", + "hex": "000000ae", + "type": "nonstandard", + "hash": "62ede8963f9387544935f168745262f703dab1fb", + "scriptPubKey": true + } + ] +} diff --git a/test/fixtures/syncscript.js b/test/fixtures/syncscript.js index 02c1f6f..8e4f24e 100644 --- a/test/fixtures/syncscript.js +++ b/test/fixtures/syncscript.js @@ -55,7 +55,7 @@ request('https://raw.githubusercontent.com/bitcoin/bitcoin/master/src/test/data/ ] }, null, ' ') - fs.writeFileSync('./test/fixtures/base58.js', 'module.exports = ' + fixture) + fs.writeFileSync('./test/fixtures/base58.json', fixture) }) request('https://raw.githubusercontent.com/bitcoin/bitcoin/master/src/test/data/base58_keys_valid.json', function (error, response, body) { @@ -115,6 +115,6 @@ request('https://raw.githubusercontent.com/bitcoin/bitcoin/master/src/test/data/ invalid2: invalid2 }, null, ' ') - fs.writeFileSync('./test/fixtures/base58check.js', 'module.exports = ' + fixture) + fs.writeFileSync('./test/fixtures/base58check.json', fixture) }) }) diff --git a/test/message.js b/test/message.js index 7f31545..f819b8f 100644 --- a/test/message.js +++ b/test/message.js @@ -5,7 +5,7 @@ var BigInteger = require('bigi') var ECKey = require('../src/eckey') var Message = require('../src/message') -var fixtures = require('./fixtures/message') +var fixtures = require('./fixtures/message.json') describe('Message', function() { var message diff --git a/test/script.js b/test/script.js index 595a130..9c18e4b 100644 --- a/test/script.js +++ b/test/script.js @@ -6,7 +6,7 @@ var Address = require('../src/address') var ECPubKey = require('../src/ecpubkey') var Script = require('../src/script') -var fixtures = require('./fixtures/script') +var fixtures = require('./fixtures/script.json') function b2h(b) { return new Buffer(b).toString('hex') } function h2b(h) { return new Buffer(h, 'hex') }