Ryan X. Charles
11 years ago
17 changed files with 338 additions and 90 deletions
@ -0,0 +1,28 @@ |
|||
'use strict'; |
|||
|
|||
var chai = require('chai'); |
|||
var bitcore = require('../bitcore'); |
|||
|
|||
var should = chai.should(); |
|||
|
|||
var BloomModule = bitcore.Script; |
|||
var Bloom; |
|||
|
|||
describe('Bloom', function() { |
|||
it('should initialze the main object', function() { |
|||
should.exist(BloomModule); |
|||
}); |
|||
it('should be able to create class', function() { |
|||
Bloom = BloomModule.class(); |
|||
should.exist(Bloom); |
|||
}); |
|||
it('should be able to create instance', function() { |
|||
var s = new Bloom(); |
|||
should.exist(s); |
|||
}); |
|||
}); |
|||
|
|||
|
|||
|
|||
|
|||
|
@ -0,0 +1,23 @@ |
|||
'use strict'; |
|||
|
|||
var chai = require('chai'); |
|||
var bitcore = require('../bitcore'); |
|||
|
|||
var should = chai.should(); |
|||
|
|||
var Key = bitcore.Key; |
|||
|
|||
describe.skip('Key', function() { |
|||
it('should initialze the main object', function() { |
|||
should.exist(Key); |
|||
}); |
|||
it('should be able to create instance', function() { |
|||
var k = new Key(); |
|||
should.exist(k); |
|||
}); |
|||
}); |
|||
|
|||
|
|||
|
|||
|
|||
|
@ -0,0 +1,37 @@ |
|||
'use strict'; |
|||
|
|||
var chai = require('chai'); |
|||
var bitcore = require('../bitcore'); |
|||
|
|||
var should = chai.should(); |
|||
|
|||
var PeerManagerModule = bitcore.PeerManager; |
|||
var PeerManager; |
|||
|
|||
describe('PeerManager', function() { |
|||
it('should initialze the main object', function() { |
|||
should.exist(PeerManagerModule); |
|||
}); |
|||
it('should be able to create class', function() { |
|||
PeerManager = PeerManagerModule.class(); |
|||
should.exist(PeerManager); |
|||
}); |
|||
it('should be able to create instance', function() { |
|||
var pm = new PeerManager(); |
|||
should.exist(pm); |
|||
}); |
|||
it('should be able to start instance', function() { |
|||
var pm = new PeerManager(); |
|||
pm.start.bind(pm).should.not.throw(); |
|||
}); |
|||
it('should be able to stop instance', function() { |
|||
var pm = new PeerManager(); |
|||
pm.start(); |
|||
pm.stop.bind(pm).should.not.throw(); |
|||
}); |
|||
}); |
|||
|
|||
|
|||
|
|||
|
|||
|
@ -0,0 +1,28 @@ |
|||
'use strict'; |
|||
|
|||
var chai = require('chai'); |
|||
var bitcore = require('../bitcore'); |
|||
|
|||
var should = chai.should(); |
|||
|
|||
var PrivateKeyModule = bitcore.PrivateKey; |
|||
var PrivateKey; |
|||
|
|||
describe('PrivateKey', function() { |
|||
it('should initialze the main object', function() { |
|||
should.exist(PrivateKeyModule); |
|||
}); |
|||
it('should be able to create class', function() { |
|||
PrivateKey = PrivateKeyModule.class(); |
|||
should.exist(PrivateKey); |
|||
}); |
|||
it('should be able to create instance', function() { |
|||
var pk = new PrivateKey(); |
|||
should.exist(pk); |
|||
}); |
|||
}); |
|||
|
|||
|
|||
|
|||
|
|||
|
@ -0,0 +1,28 @@ |
|||
'use strict'; |
|||
|
|||
var chai = require('chai'); |
|||
var bitcore = require('../bitcore'); |
|||
|
|||
var should = chai.should(); |
|||
|
|||
var RpcClientModule = bitcore.RpcClient; |
|||
var RpcClient; |
|||
RpcClient = RpcClientModule.class(); |
|||
|
|||
describe('RpcClient', function() { |
|||
it('should initialze the main object', function() { |
|||
should.exist(RpcClientModule); |
|||
}); |
|||
it('should be able to create class', function() { |
|||
should.exist(RpcClient); |
|||
}); |
|||
it('should be able to create instance', function() { |
|||
var s = new RpcClient(); |
|||
should.exist(s); |
|||
}); |
|||
}); |
|||
|
|||
|
|||
|
|||
|
|||
|
@ -1,30 +1,28 @@ |
|||
'use strict'; |
|||
|
|||
|
|||
|
|||
var chai = require('chai'); |
|||
var bitcore = require('../bitcore'); |
|||
|
|||
var should = chai.should(); |
|||
|
|||
var SINKeyModule = bitcore.SINKey; |
|||
var SINKey; |
|||
var SINModule = bitcore.SIN; |
|||
var SIN; |
|||
|
|||
|
|||
describe('SINKey', function() { |
|||
describe('SIN', function() { |
|||
it('should initialze the main object', function() { |
|||
should.exist(SINKeyModule); |
|||
should.exist(SINModule); |
|||
}); |
|||
it('should be able to create class', function() { |
|||
SINKey = SINKeyModule.class(); |
|||
should.exist(SINKey); |
|||
SIN = SINModule.class(); |
|||
should.exist(SIN); |
|||
}); |
|||
it('should be able to create instance', function() { |
|||
var sk = new SINKey(); |
|||
sk.generate(); |
|||
should.exist(sk.created); |
|||
should.exist(sk.privKey.private); |
|||
should.exist(sk.privKey.public); |
|||
should.exist(sk.privKey.compressed); |
|||
var s = new SIN(); |
|||
should.exist(s); |
|||
}); |
|||
}); |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
@ -0,0 +1,30 @@ |
|||
'use strict'; |
|||
|
|||
|
|||
|
|||
var chai = require('chai'); |
|||
var bitcore = require('../bitcore'); |
|||
|
|||
var should = chai.should(); |
|||
|
|||
var SINKeyModule = bitcore.SINKey; |
|||
var SINKey; |
|||
|
|||
|
|||
describe('SINKey', function() { |
|||
it('should initialze the main object', function() { |
|||
should.exist(SINKeyModule); |
|||
}); |
|||
it('should be able to create class', function() { |
|||
SINKey = SINKeyModule.class(); |
|||
should.exist(SINKey); |
|||
}); |
|||
it('should be able to create instance', function() { |
|||
var sk = new SINKey(); |
|||
sk.generate(); |
|||
should.exist(sk.created); |
|||
should.exist(sk.privKey.private); |
|||
should.exist(sk.privKey.public); |
|||
should.exist(sk.privKey.compressed); |
|||
}); |
|||
}); |
@ -0,0 +1,28 @@ |
|||
'use strict'; |
|||
|
|||
var chai = require('chai'); |
|||
var bitcore = require('../bitcore'); |
|||
|
|||
var should = chai.should(); |
|||
|
|||
var WalletModule = bitcore.Wallet; |
|||
var Wallet; |
|||
|
|||
describe('Wallet', function() { |
|||
it('should initialze the main object', function() { |
|||
should.exist(WalletModule); |
|||
}); |
|||
it('should be able to create class', function() { |
|||
Wallet = WalletModule.class(); |
|||
should.exist(Wallet); |
|||
}); |
|||
it('should be able to create instance', function() { |
|||
var s = new Wallet(); |
|||
should.exist(s); |
|||
}); |
|||
}); |
|||
|
|||
|
|||
|
|||
|
|||
|
@ -0,0 +1,31 @@ |
|||
'use strict'; |
|||
|
|||
var chai = require('chai'); |
|||
var bitcore = require('../bitcore'); |
|||
|
|||
var should = chai.should(); |
|||
|
|||
var WalletKeyModule = bitcore.WalletKey; |
|||
var networks = bitcore.networks; |
|||
var WalletKey; |
|||
|
|||
describe('WalletKey', function() { |
|||
it('should initialze the main object', function() { |
|||
should.exist(WalletKeyModule); |
|||
}); |
|||
it('should be able to create class', function() { |
|||
WalletKey = WalletKeyModule.class(); |
|||
should.exist(WalletKey); |
|||
}); |
|||
it('should be able to create instance', function() { |
|||
var s = new WalletKey({ |
|||
network: networks.livenet |
|||
}); |
|||
should.exist(s); |
|||
}); |
|||
}); |
|||
|
|||
|
|||
|
|||
|
|||
|
@ -1,45 +0,0 @@ |
|||
'use strict'; |
|||
|
|||
var chai = require('chai'); |
|||
var bitcore = require('../bitcore'); |
|||
|
|||
var expect = chai.expect; |
|||
var should = chai.should(); |
|||
|
|||
var bignum = bitcore.bignum; |
|||
var base58 = bitcore.base58; |
|||
var base58Check = base58.base58Check; |
|||
|
|||
describe('bignum module basics', function() { |
|||
it('should initialze the main object', function() { |
|||
should.exist(bitcore.bignum); |
|||
}); |
|||
it('should create a bignum from string', function() { |
|||
var n = bignum('9832087987979879879879879879879879879879879879'); |
|||
should.exist(n); |
|||
}); |
|||
it('should perform basic math operations', function() { |
|||
var b = bignum('782910138827292261791972728324982') |
|||
.sub('182373273283402171237474774728373') |
|||
.div(13); |
|||
b.toNumber().should.equal(46195143503376160811884457968969); |
|||
}); |
|||
}); |
|||
|
|||
|
|||
describe('base58 module', function() { |
|||
it('should initialze the main object', function() { |
|||
should.exist(bitcore.base58); |
|||
}); |
|||
it('should obtain the same string in base58 roundtrip', function() { |
|||
var m = 'mqqa8xSMVDyf9QxihGnPtap6Mh6qemUkcu'; |
|||
base58.encode(base58.decode(m)).should.equal(m); |
|||
}); |
|||
it('should obtain the same string in base58Check roundtrip', function() { |
|||
var m = '1QCJj1gPZKx2EwzGo9Ri8mMBs39STvDYcv'; |
|||
base58Check.encode(base58Check.decode(m)).should.equal(m); |
|||
}); |
|||
}); |
|||
|
|||
|
|||
|
Loading…
Reference in new issue