Add a pre-generated address to the shared branch

This commit is contained in:
Yemel Jardi 2014-07-31 16:13:27 -03:00
commit fdabdc64fe
5 changed files with 18 additions and 7 deletions

View file

@ -46,6 +46,10 @@ FakeWallet.prototype.getAddressesInfo = function() {
return ret;
};
FakeWallet.prototype.isReady = function() {
return true;
}
FakeWallet.prototype.getBalance = function(cb) {
return cb(null, this.balance, this.balanceByAddr, this.safeBalance);

View file

@ -145,9 +145,8 @@ describe('PublicKeyRing model', function() {
var k = createW();
var w = k.w;
var a = w.getAddresses();
a.length.should.equal(0);
a.length.should.equal(1);
[true, false].forEach(function(isChange){
for (var i = 0; i < 2; i++) {
@ -156,15 +155,22 @@ describe('PublicKeyRing model', function() {
});
var as = w.getAddressesInfo();
as.length.should.equal(4);
as.length.should.equal(5); // include pre-generated shared one
for (var j in as) {
var a = as[j];
a.address.isValid().should.equal(true);
a.addressStr.should.equal(a.address.toString());
a.isChange.should.equal([false, false, true, true][j]);
a.isChange.should.equal([false, false, false, true, true][j]);
}
});
it('should start with one shared address', function() {
var k = createW();
var a = k.w.getAddresses();
a.length.should.equal(1);
});
it('should count generation indexes', function() {
var k = createW();
var w = k.w;

View file

@ -594,7 +594,7 @@ describe('Wallet model', function() {
it('should get balance', function(done) {
var w = createW();
var w = createW2();
var spy = sinon.spy(w.blockchain, 'getUnspent');
w.blockchain.fixUnspent([]);
w.getBalance(function(err, balance, balanceByAddr, safeBalance) {