fix peers, pubkey WIP
This commit is contained in:
parent
a658ec8452
commit
9ca83e35fc
11 changed files with 228 additions and 142 deletions
|
|
@ -3,11 +3,11 @@ var FakeStorage = function(){
|
|||
this.storage = {};
|
||||
};
|
||||
|
||||
FakeStorage.prototype.read = function (id) {
|
||||
FakeStorage.prototype.set = function (id) {
|
||||
return this.storage[id];
|
||||
};
|
||||
|
||||
FakeStorage.prototype.save = function(id, payload) {
|
||||
FakeStorage.prototype.get = function(id, payload) {
|
||||
this.storage[id] = payload;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -13,13 +13,13 @@ var aMasterPubKey = 'tprv8ZgxMBicQKsPdSVTiWXEqCCzqRaRr9EAQdn5UVMpT9UHX67Dh1FmzEM
|
|||
|
||||
|
||||
var config = {
|
||||
network:'livenet',
|
||||
networkName:'livenet',
|
||||
};
|
||||
|
||||
var createW = function (network) {
|
||||
var createW = function (networkName) {
|
||||
|
||||
var config = {
|
||||
network: network || 'livenet',
|
||||
networkName: networkName || 'livenet',
|
||||
};
|
||||
|
||||
var w = new PublicKeyRing(config);
|
||||
|
|
@ -39,7 +39,7 @@ describe('PublicKeyRing model', function() {
|
|||
|
||||
it('should create an instance (livenet)', function () {
|
||||
var w = new PublicKeyRing({
|
||||
network: config.network
|
||||
networkName: config.networkName
|
||||
});
|
||||
should.exist(w);
|
||||
w.network.name.should.equal('livenet');
|
||||
|
|
@ -158,7 +158,7 @@ describe('PublicKeyRing model', function() {
|
|||
w.generateAddress(false);
|
||||
|
||||
var w2 = new PublicKeyRing({
|
||||
network: 'livenet',
|
||||
networkName: 'livenet',
|
||||
id: w.id,
|
||||
});
|
||||
w2.merge(w.toObj()).should.equal(true);
|
||||
|
|
@ -182,33 +182,48 @@ describe('PublicKeyRing model', function() {
|
|||
w.generateAddress(false);
|
||||
|
||||
|
||||
|
||||
var w2 = new PublicKeyRing({
|
||||
networkName: 'livenet',
|
||||
});
|
||||
(function() { w2.merge(w.toObj());}).should.throw();
|
||||
(function() { w2.merge(w,true);}).should.throw();
|
||||
|
||||
console.log('[test.publickeyring.js.190]'); //TODO
|
||||
w2.merge(w.toObj(),true).should.equal(true);
|
||||
|
||||
console.log('[test.publickeyring.js.193]'); //TODO
|
||||
|
||||
|
||||
var w3 = new PublicKeyRing({
|
||||
network: 'livenet',
|
||||
networkName: 'livenet',
|
||||
id: w.id,
|
||||
requiredCopayers: 2,
|
||||
});
|
||||
(function() { w3.merge(w.toObj());}).should.throw();
|
||||
|
||||
var w4 = new PublicKeyRing({
|
||||
network: 'testnet',
|
||||
networkName: 'testnet',
|
||||
id: w.id,
|
||||
});
|
||||
(function() { w4.merge(w.toObj());}).should.throw();
|
||||
|
||||
var w5 = new PublicKeyRing({
|
||||
network: 'livenet',
|
||||
networkName: 'livenet',
|
||||
id: w.id,
|
||||
totalCopayers: 4,
|
||||
});
|
||||
(function() { w5.merge(w.toObj());}).should.throw();
|
||||
|
||||
var w6 = new PublicKeyRing({
|
||||
network: 'livenet',
|
||||
networkName: 'livenet',
|
||||
id: w.id,
|
||||
});
|
||||
(function() { w6.merge(w);}).should.throw();
|
||||
w.networkName= 'livenet';
|
||||
(function() { w6.merge(w);}).should.throw();
|
||||
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
|
@ -222,7 +237,7 @@ describe('PublicKeyRing model', function() {
|
|||
}
|
||||
|
||||
var w2 = new PublicKeyRing({
|
||||
network: 'livenet',
|
||||
networkName: 'livenet',
|
||||
id: w.id,
|
||||
});
|
||||
should.exist(w);
|
||||
|
|
@ -248,7 +263,7 @@ describe('PublicKeyRing model', function() {
|
|||
for(var i=0; i<5; i++) {
|
||||
w.haveAllRequiredPubKeys().should.equal(false);
|
||||
var w2 = new PublicKeyRing({
|
||||
network: 'livenet',
|
||||
networkName: 'livenet',
|
||||
id: w.id,
|
||||
});
|
||||
w2.addCopayer();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue