You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
40 lines
1.0 KiB
40 lines
1.0 KiB
'use strict';
|
|
|
|
var chai = require('chai');
|
|
var bitcore = require('../bitcore');
|
|
|
|
var should = chai.should();
|
|
|
|
var ScriptModule = bitcore.Script;
|
|
var Address = bitcore.Address.class();
|
|
var Script;
|
|
|
|
describe('Script', function() {
|
|
it('should initialze the main object', function() {
|
|
should.exist(ScriptModule);
|
|
});
|
|
it('should be able to create class', function() {
|
|
Script = ScriptModule.class();
|
|
should.exist(Script);
|
|
});
|
|
it('should be able to create instance', 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().should.be.false;
|
|
});
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|