Browse Source

Added some tests for Script

patch-2
Manuel Araoz 11 years ago
parent
commit
262a5d7189
  1. 2
      browser/vendor_load.js
  2. 13
      test/test.Script.js

2
browser/vendor_load.js

@ -1,5 +1,5 @@
// load modules needed for testing in the browser
var fs = require('fs');
//var fs = require('fs');

13
test/test.Script.js

@ -6,6 +6,7 @@ var bitcore = require('../bitcore');
var should = chai.should();
var ScriptModule = bitcore.Script;
var Address = bitcore.Address.class();
var Script;
describe('Script', function() {
@ -20,6 +21,18 @@ describe('Script', function() {
var s = new Script();
should.exist(s);
});
it('should be able to create Script from Address', function() {
var addr = new Address('1J57QmkaQ6JohJoQyaUJwngJ2vTQ3C6gHi');
var script = Script.createPubKeyHashOut(addr.payload());
should.exist(script);
script.isPubkeyHash().should.be.true;
});
it('isP2SH should work', function() {
var addr = new Address('1J57QmkaQ6JohJoQyaUJwngJ2vTQ3C6gHi');
var script = Script.createPubKeyHashOut(addr.payload());
script.isP2SH.bind(script).should.not.throw(Error);
script.isP2SH().should.be.false;
});
});

Loading…
Cancel
Save