mirror of https://github.com/BTCPrivate/copay.git
add tests for Wallet
This commit is contained in:
parent
8e81e9108f
commit
7ae6438478
|
@ -233,11 +233,11 @@ Wallet.prototype.getCopayerId = function(index) {
|
|||
|
||||
|
||||
Wallet.prototype.getMyCopayerId = function() {
|
||||
return this.getCopayerId(0);
|
||||
return this.getCopayerId(0); //copayer id is hex of a public key
|
||||
};
|
||||
|
||||
Wallet.prototype.getMyCopayerIdPriv = function() {
|
||||
return this.privateKey.getIdPriv();
|
||||
return this.privateKey.getIdPriv(); //copayer idpriv is hex of a private key
|
||||
};
|
||||
|
||||
|
||||
|
@ -260,7 +260,7 @@ Wallet.prototype._lockIncomming = function() {
|
|||
this.network.lockIncommingConnections(this.publicKeyRing.getAllCopayerIds());
|
||||
};
|
||||
|
||||
Wallet.prototype.netStart = function() {
|
||||
Wallet.prototype.netStart = function(callback) {
|
||||
var self = this;
|
||||
var net = this.network;
|
||||
net.removeAllListeners();
|
||||
|
|
|
@ -755,4 +755,49 @@ describe('Wallet model', function() {
|
|||
Object.keys(w.addressBook).length.should.equal(3);
|
||||
});
|
||||
|
||||
it('#getNetworkName', function() {
|
||||
var w = createW();
|
||||
w.getNetworkName().should.equal('testnet');
|
||||
});
|
||||
|
||||
describe('#getMyCopayerId', function() {
|
||||
it('should call getCopayerId', function() {
|
||||
//this.timeout(10000);
|
||||
var w = createW2();
|
||||
w.getCopayerId = sinon.spy();
|
||||
w.getMyCopayerId();
|
||||
w.getCopayerId.calledOnce.should.equal(true);
|
||||
});
|
||||
});
|
||||
|
||||
describe('#getMyCopayerIdPriv', function() {
|
||||
it('should call privateKey.getIdPriv', function() {
|
||||
//this.timeout(10000);
|
||||
var w = createW2();
|
||||
w.privateKey.getIdPriv = sinon.spy();
|
||||
w.getMyCopayerIdPriv();
|
||||
w.privateKey.getIdPriv.calledOnce.should.equal(true);
|
||||
});
|
||||
});
|
||||
|
||||
describe('#netStart', function() {
|
||||
|
||||
it('should call Network.start', function() {
|
||||
//this.timeout(10000);
|
||||
var w = createW2();
|
||||
w.network.start = sinon.spy();
|
||||
w.netStart();
|
||||
w.network.start.calledOnce.should.equal(true);
|
||||
});
|
||||
|
||||
it('should call Network.start with a private key', function() {
|
||||
//this.timeout(10000);
|
||||
var w = createW2();
|
||||
w.network.start = sinon.spy();
|
||||
w.netStart();
|
||||
w.network.start.getCall(0).args[0].privkey.length.should.equal(64);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue