From d0d5248bf5821dfd8aa0e94c3cbd681e9981856d Mon Sep 17 00:00:00 2001 From: Manuel Araoz Date: Mon, 28 Jul 2014 17:18:08 -0300 Subject: [PATCH] add getHashType tests --- test/test.Script.js | 50 +++++++++++++++++++++++++++++++-------------- 1 file changed, 35 insertions(+), 15 deletions(-) diff --git a/test/test.Script.js b/test/test.Script.js index 9bb3ef2..df03ae5 100644 --- a/test/test.Script.js +++ b/test/test.Script.js @@ -5,19 +5,15 @@ var bitcore = bitcore || require('../bitcore'); var should = chai.should(); -var ScriptModule = bitcore.Script; +var Script = bitcore.Script; var Address = bitcore.Address; var Opcode = bitcore.Opcode; +var Transaction = bitcore.Transaction; var networks = bitcore.networks; -var Script; var testdata = testdata || require('./testdata'); describe('Script', function() { - it('should initialze the main object', function() { - should.exist(ScriptModule); - }); it('should be able to create class', function() { - Script = ScriptModule; should.exist(Script); }); it('should be able to create instance', function() { @@ -151,7 +147,6 @@ describe('Script', function() { describe('#countMissingSignatures', function() { - Script = ScriptModule; it('should count missing signature in empty scripts', function() { var s = new Script(); s.countMissingSignatures().should.equal(1); @@ -201,7 +196,12 @@ describe('Script', function() { var testF = function(raw, expected) { var s = new Script(new Buffer(raw, 'hex')); var actual = f.bind(s)(); - actual.should.equal(expected); + if (expected !== null) { + should.exist(actual); + actual.should.equal(expected); + } else { + should.not.exist(actual); + } }; return testF; }; @@ -289,21 +289,41 @@ describe('Script', function() { var s = new Script(new Buffer(raw, 'hex')); var actual = s.getSignatures(); actual.length.should.equal(expected.length); - for (var i=0; i