diff --git a/bitcore.js b/bitcore.js index ebaa8140e..551a8341a 100644 --- a/bitcore.js +++ b/bitcore.js @@ -5,8 +5,9 @@ module.exports.bignum = require('bignum'); module.exports.base58 = require('base58-native'); -module.exports.Manu = require('./util/manu').class(); module.exports.EncodedData = require('./util/EncodedData'); +module.exports.VersionedData = require('./util/VersionedData'); +module.exports.Address= require('./Address'); if (typeof process.versions === 'undefined') { diff --git a/test/index.html b/test/index.html index 4420f74ec..0d62a92fd 100644 --- a/test/index.html +++ b/test/index.html @@ -18,6 +18,8 @@ + + diff --git a/test/test.Address.js b/test/test.Address.js index c62ede423..ec0787bc0 100644 --- a/test/test.Address.js +++ b/test/test.Address.js @@ -8,14 +8,25 @@ var should = chai.should(); var AddressModule = bitcore.Address; var Address; -describe.skip('Address', function() { +describe('Address', function() { it('should initialze the main object', function() { should.exist(AddressModule); }); it('should be able to create class', function() { Address = AddressModule.class(); + should.exist(Address); }); it('should be able to create Address object', 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"); + 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.EncodedData.js b/test/test.EncodedData.js index a5f7e5bdc..26c657b6c 100644 --- a/test/test.EncodedData.js +++ b/test/test.EncodedData.js @@ -16,8 +16,8 @@ describe('EncodedData', function() { EncodedData = EncodedDataModule.class(); should.exist(EncodedData); }); - it('should be able to create EncodedData object', function() { - var ed = new EncodedData(); + it('should be able to create an instance', function() { + var ed = new EncodedData('1GMx4HdDmN78xzGvdQYkwrVqkmLDG1aMNT'); should.exist(ed); }); }); diff --git a/test/test.VersionedData.js b/test/test.VersionedData.js new file mode 100644 index 000000000..0f18360f6 --- /dev/null +++ b/test/test.VersionedData.js @@ -0,0 +1,34 @@ +'use strict'; + +var chai = require('chai'); +var bitcore = require('../bitcore'); + +var should = chai.should(); + +var VersionedDataModule = bitcore.VersionedData; +var VersionedData; + +describe('VersionedData', function() { + it('should initialze the main object', function() { + should.exist(VersionedDataModule); + }); + it('should be able to create class', function() { + VersionedData = VersionedDataModule.class(); + should.exist(VersionedData); + }); + it('should be able to create an instance', function() { + var vd = new VersionedData(); + should.exist(vd); + }); + it('should get correct version', function() { + var vda = new VersionedData('1GMx4HdDmN78xzGvdQYkwrVqkmLDG1aMNT'); + var vdb = new VersionedData('3746djr32k2Lp23UUbdkCTQ6zhMJ7d8MD7'); + vda.version().should.equal(0); + vdb.version().should.equal(5); + }); +}); + + + + +