From e295e33800ce17156a7d9d8962c26092f42fd08d Mon Sep 17 00:00:00 2001 From: Manuel Araoz Date: Thu, 6 Feb 2014 12:57:47 -0300 Subject: [PATCH] starting with Transaction class --- bitcore.js | 6 +++++- test/index.html | 2 ++ test/test.Address.js | 8 ++++---- test/test.Script.js | 28 ++++++++++++++++++++++++++++ test/test.Transaction.js | 28 ++++++++++++++++++++++++++++ test/test.misc.js | 20 ++++++++++++++++++++ 6 files changed, 87 insertions(+), 5 deletions(-) create mode 100644 test/test.Script.js create mode 100644 test/test.Transaction.js create mode 100644 test/test.misc.js diff --git a/bitcore.js b/bitcore.js index 551a834..699a37a 100644 --- a/bitcore.js +++ b/bitcore.js @@ -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') { diff --git a/test/index.html b/test/index.html index 0d62a92..54914e4 100644 --- a/test/index.html +++ b/test/index.html @@ -20,6 +20,8 @@ + + diff --git a/test/test.Address.js b/test/test.Address.js index ec0787b..5713cf5 100644 --- a/test/test.Address.js +++ b/test/test.Address.js @@ -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); diff --git a/test/test.Script.js b/test/test.Script.js new file mode 100644 index 0000000..93085cc --- /dev/null +++ b/test/test.Script.js @@ -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); + }); +}); + + + + + diff --git a/test/test.Transaction.js b/test/test.Transaction.js new file mode 100644 index 0000000..98889de --- /dev/null +++ b/test/test.Transaction.js @@ -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); + }); +}); + + + + + diff --git a/test/test.misc.js b/test/test.misc.js new file mode 100644 index 0000000..7d28cbe --- /dev/null +++ b/test/test.misc.js @@ -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); + }); +}); + + + + +