starting with Transaction class
This commit is contained in:
parent
fc93218c56
commit
e295e33800
|
@ -7,7 +7,11 @@ module.exports.bignum = require('bignum');
|
|||
module.exports.base58 = require('base58-native');
|
||||
module.exports.EncodedData = require('./util/EncodedData');
|
||||
module.exports.VersionedData = require('./util/VersionedData');
|
||||
module.exports.Address= require('./Address');
|
||||
module.exports.Address = require('./Address');
|
||||
module.exports.config = require('./config');
|
||||
module.exports.log = require('./util/log');
|
||||
//module.exports.Script = require('./Script');
|
||||
//module.exports.Transaction = require('./Transaction');
|
||||
|
||||
|
||||
if (typeof process.versions === 'undefined') {
|
||||
|
|
|
@ -20,6 +20,8 @@
|
|||
<script src="test.EncodedData.js"></script>
|
||||
<script src="test.VersionedData.js"></script>
|
||||
<script src="test.Address.js"></script>
|
||||
<script src="test.Script.js"></script>
|
||||
<script src="test.misc.js"></script>
|
||||
<script>
|
||||
mocha.run();
|
||||
</script>
|
||||
|
|
|
@ -16,14 +16,14 @@ describe('Address', function() {
|
|||
Address = AddressModule.class();
|
||||
should.exist(Address);
|
||||
});
|
||||
it('should be able to create Address object', function() {
|
||||
it('should be able to create instance', function() {
|
||||
var a = new Address('1KfyjCgBSMsLqiCbakfSdeoBUqMqLUiu3T');
|
||||
should.exist(a);
|
||||
});
|
||||
it('should validate correctly', function() {
|
||||
var a = new Address("1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa");
|
||||
var m = new Address("32QBdjycLwbDTuGafUwaU5p5GxzSLPYoF6");
|
||||
var b = new Address("11111111111111111111111111122222234");
|
||||
var a = new Address('1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa');
|
||||
var m = new Address('32QBdjycLwbDTuGafUwaU5p5GxzSLPYoF6');
|
||||
var b = new Address('11111111111111111111111111122222234');
|
||||
a.validate.bind(a).should.not.throw(Error);
|
||||
m.validate.bind(m).should.not.throw(Error);
|
||||
b.validate.bind(b).should.throw(Error);
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
'use strict';
|
||||
|
||||
var chai = require('chai');
|
||||
var bitcore = require('../bitcore');
|
||||
|
||||
var should = chai.should();
|
||||
|
||||
var ScriptModule = bitcore.Script;
|
||||
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);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
'use strict';
|
||||
|
||||
var chai = require('chai');
|
||||
var bitcore = require('../bitcore');
|
||||
|
||||
var should = chai.should();
|
||||
|
||||
var TransactionModule = bitcore.Transaction;
|
||||
var Transaction;
|
||||
|
||||
describe('Transaction', function() {
|
||||
it('should initialze the main object', function() {
|
||||
should.exist(TransactionModule);
|
||||
});
|
||||
it('should be able to create class', function() {
|
||||
Transaction = TransactionModule.class();
|
||||
should.exist(Transaction);
|
||||
});
|
||||
it('should be able to create instance', function() {
|
||||
var t = new Transaction();
|
||||
should.exist(t);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
'use strict';
|
||||
|
||||
var chai = require('chai');
|
||||
var bitcore = require('../bitcore');
|
||||
|
||||
var should = chai.should();
|
||||
|
||||
describe('Miscelaneous stuff', function() {
|
||||
it('should initialze the config object', function() {
|
||||
should.exist(bitcore.config);
|
||||
});
|
||||
it('should initialze the log object', function() {
|
||||
should.exist(bitcore.log);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue