run js-beautify on everything
...with two spaces. Command: js-beautify -s 2 -r [filename]
This commit is contained in:
parent
da445e7c69
commit
ea2e2d4e19
49 changed files with 859 additions and 682 deletions
|
|
@ -1,43 +1,43 @@
|
|||
'use strict';
|
||||
|
||||
var chai = chai || require('chai');
|
||||
var should = chai.should();
|
||||
var bitcore = bitcore || require('bitcore');
|
||||
var Transaction = bitcore.Transaction;
|
||||
var buffertools = bitcore.buffertools;
|
||||
var WalletKey = bitcore.WalletKey;
|
||||
var Key = bitcore.Key;
|
||||
var bignum = bitcore.Bignum;
|
||||
var networks = bitcore.networks;
|
||||
var Address = bitcore.Address;
|
||||
var BitcorePrivateKey = bitcore.PrivateKey;
|
||||
var chai = chai || require('chai');
|
||||
var should = chai.should();
|
||||
var bitcore = bitcore || require('bitcore');
|
||||
var Transaction = bitcore.Transaction;
|
||||
var buffertools = bitcore.buffertools;
|
||||
var WalletKey = bitcore.WalletKey;
|
||||
var Key = bitcore.Key;
|
||||
var bignum = bitcore.Bignum;
|
||||
var networks = bitcore.networks;
|
||||
var Address = bitcore.Address;
|
||||
var BitcorePrivateKey = bitcore.PrivateKey;
|
||||
try {
|
||||
var copay = require('copay'); //browser
|
||||
} catch (e) {
|
||||
var copay = require('../copay'); //node
|
||||
}
|
||||
var PrivateKey = copay.PrivateKey || require('../js/models/core/PrivateKey');
|
||||
var PrivateKey = copay.PrivateKey || require('../js/models/core/PrivateKey');
|
||||
|
||||
var config = {
|
||||
networkName:'livenet',
|
||||
networkName: 'livenet',
|
||||
};
|
||||
|
||||
describe('PrivateKey model', function() {
|
||||
|
||||
it('should create an instance', function () {
|
||||
it('should create an instance', function() {
|
||||
var w = new PrivateKey(config);
|
||||
should.exist(w);
|
||||
should.exist(w.bip);
|
||||
should.exist(w.bip.derive);
|
||||
});
|
||||
|
||||
it('should derive priv keys', function () {
|
||||
it('should derive priv keys', function() {
|
||||
var pk = new PrivateKey(config);
|
||||
for(var j=0; j<2; j++) {
|
||||
for(var i=0; i<3; i++) {
|
||||
var wk = pk.get(i,j);
|
||||
for (var j = 0; j < 2; j++) {
|
||||
for (var i = 0; i < 3; i++) {
|
||||
var wk = pk.get(i, j);
|
||||
should.exist(wk);
|
||||
var o=wk.storeObj();
|
||||
var o = wk.storeObj();
|
||||
should.exist(o);
|
||||
should.exist(o.priv);
|
||||
should.exist(o.pub);
|
||||
|
|
@ -50,14 +50,14 @@ describe('PrivateKey model', function() {
|
|||
}
|
||||
}
|
||||
});
|
||||
it('should derive priv keys array', function () {
|
||||
it('should derive priv keys array', function() {
|
||||
var w = new PrivateKey(config);
|
||||
var wks = w.getAll(2,3);
|
||||
var wks = w.getAll(2, 3);
|
||||
wks.length.should.equal(5);
|
||||
for(var j=0; j<wks.length; j++) {
|
||||
for (var j = 0; j < wks.length; j++) {
|
||||
var wk = wks[j];
|
||||
should.exist(wk);
|
||||
var o=wk.storeObj();
|
||||
var o = wk.storeObj();
|
||||
should.exist(o);
|
||||
should.exist(o.priv);
|
||||
should.exist(o.pub);
|
||||
|
|
@ -70,7 +70,7 @@ describe('PrivateKey model', function() {
|
|||
}
|
||||
});
|
||||
|
||||
it('fromObj toObj roundtrip', function () {
|
||||
it('fromObj toObj roundtrip', function() {
|
||||
var w1 = new PrivateKey(config);
|
||||
var o = JSON.parse(JSON.stringify(w1.toObj()))
|
||||
var w2 = PrivateKey.fromObj(o);
|
||||
|
|
@ -78,17 +78,17 @@ describe('PrivateKey model', function() {
|
|||
w2.toObj().extendedPrivateKeyString.should.equal(w1.toObj().extendedPrivateKeyString);
|
||||
w2.getId().should.equal(w1.getId());
|
||||
|
||||
JSON.stringify(w2.get(1,1).storeObj()).should
|
||||
.equal(JSON.stringify(w1.get(1,1).storeObj()));
|
||||
JSON.stringify(w2.get(1,0).storeObj()).should
|
||||
.equal(JSON.stringify(w1.get(1,0).storeObj()));
|
||||
JSON.stringify(w2.get(1, 1).storeObj()).should
|
||||
.equal(JSON.stringify(w1.get(1, 1).storeObj()));
|
||||
JSON.stringify(w2.get(1, 0).storeObj()).should
|
||||
.equal(JSON.stringify(w1.get(1, 0).storeObj()));
|
||||
});
|
||||
|
||||
|
||||
describe('#getId', function() {
|
||||
it('should calculate the copayerId', function() {
|
||||
var w1 = new PrivateKey(config);
|
||||
should.exist(w1.getId());
|
||||
w1.getId().length.should.equal(33*2);
|
||||
w1.getId().length.should.equal(33 * 2);
|
||||
});
|
||||
});
|
||||
|
||||
|
|
@ -96,7 +96,7 @@ describe('PrivateKey model', function() {
|
|||
it('should calculate .id', function() {
|
||||
var w1 = new PrivateKey(config);
|
||||
should.exist(w1.getIdPriv());
|
||||
w1.getIdPriv().length.should.equal(32*2);
|
||||
w1.getIdPriv().length.should.equal(32 * 2);
|
||||
});
|
||||
});
|
||||
|
||||
|
|
@ -106,8 +106,8 @@ describe('PrivateKey model', function() {
|
|||
w1.cacheId();
|
||||
var pub = w1.id;
|
||||
var priv = w1.idpriv;
|
||||
pub.length.should.equal(33*2);
|
||||
priv.length.should.equal(32*2);
|
||||
pub.length.should.equal(33 * 2);
|
||||
priv.length.should.equal(32 * 2);
|
||||
});
|
||||
|
||||
it('should set the id equal to the public key of the idpriv private key', function() {
|
||||
|
|
@ -115,8 +115,8 @@ describe('PrivateKey model', function() {
|
|||
w1.cacheId();
|
||||
var pub = w1.id;
|
||||
var priv = w1.idpriv;
|
||||
pub.length.should.equal(33*2);
|
||||
priv.length.should.equal(32*2);
|
||||
pub.length.should.equal(33 * 2);
|
||||
priv.length.should.equal(32 * 2);
|
||||
|
||||
var key1 = new bitcore.Key();
|
||||
key1.private = new bitcore.Buffer(priv, 'hex');
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue