Merge pull request #1063 from greggzigler/JSHint
Add TxProposals to mocha test page, apply some jshint error corrections
This commit is contained in:
commit
1a5d28fb50
6 changed files with 16 additions and 12 deletions
|
|
@ -25,7 +25,7 @@ angular.module('copayApp.controllers').controller('OpenController',
|
||||||
Passphrase.getBase64Async(password, function(passphrase) {
|
Passphrase.getBase64Async(password, function(passphrase) {
|
||||||
var w, errMsg;
|
var w, errMsg;
|
||||||
try {
|
try {
|
||||||
var w = walletFactory.open($scope.selectedWalletId, {
|
w = walletFactory.open($scope.selectedWalletId, {
|
||||||
passphrase: passphrase
|
passphrase: passphrase
|
||||||
});
|
});
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,7 @@ angular.module('copayApp.filters', [])
|
||||||
})
|
})
|
||||||
.filter('limitAddress', function() {
|
.filter('limitAddress', function() {
|
||||||
return function(elements, showAll) {
|
return function(elements, showAll) {
|
||||||
var elements = elements.sort(function(a, b) {
|
elements = elements.sort(function(a, b) {
|
||||||
return (+b.owned) - (+a.owned);
|
return (+b.owned) - (+a.owned);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -12,11 +12,11 @@ Message.encode = function(topubkey, fromkey, payload, opts) {
|
||||||
//i.e., increment version1 to prevent communications with old clients
|
//i.e., increment version1 to prevent communications with old clients
|
||||||
var version2 = new Buffer([0]); //peers will not reject messages containing not-understood version2
|
var version2 = new Buffer([0]); //peers will not reject messages containing not-understood version2
|
||||||
//i.e., increment version2 to allow communication with old clients, but signal new clients
|
//i.e., increment version2 to allow communication with old clients, but signal new clients
|
||||||
|
var nonce;
|
||||||
if (opts && opts.nonce && Buffer.isBuffer(opts.nonce) && opts.nonce.length == 8) {
|
if (opts && opts.nonce && Buffer.isBuffer(opts.nonce) && opts.nonce.length == 8) {
|
||||||
var nonce = opts.nonce;
|
nonce = opts.nonce;
|
||||||
} else {
|
} else {
|
||||||
var nonce = new Buffer(8);
|
nonce = new Buffer(8);
|
||||||
nonce.fill(0); //nonce is a big endian 8 byte number
|
nonce.fill(0); //nonce is a big endian 8 byte number
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -33,10 +33,11 @@ Message.encode = function(topubkey, fromkey, payload, opts) {
|
||||||
};
|
};
|
||||||
|
|
||||||
Message.decode = function(key, encoded, opts) {
|
Message.decode = function(key, encoded, opts) {
|
||||||
|
var prevnonce;
|
||||||
if (opts && opts.prevnonce && Buffer.isBuffer(opts.prevnonce) && opts.prevnonce.length == 8) {
|
if (opts && opts.prevnonce && Buffer.isBuffer(opts.prevnonce) && opts.prevnonce.length == 8) {
|
||||||
var prevnonce = opts.prevnonce;
|
prevnonce = opts.prevnonce;
|
||||||
} else {
|
} else {
|
||||||
var prevnonce = new Buffer(8);
|
prevnonce = new Buffer(8);
|
||||||
prevnonce.fill(0); //nonce is a big endian 8 byte number
|
prevnonce.fill(0); //nonce is a big endian 8 byte number
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,7 @@
|
||||||
<script src="test.PrivateKey.js"></script>
|
<script src="test.PrivateKey.js"></script>
|
||||||
<script src="test.PublicKeyRing.js"></script>
|
<script src="test.PublicKeyRing.js"></script>
|
||||||
<script src="test.storage.LocalEncrypted.js"></script>
|
<script src="test.storage.LocalEncrypted.js"></script>
|
||||||
|
<script src="test.TxProposals.js"></script>
|
||||||
<script src="test.Wallet.js"></script>
|
<script src="test.Wallet.js"></script>
|
||||||
<script src="test.WalletFactory.js"></script>
|
<script src="test.WalletFactory.js"></script>
|
||||||
<script src="test.performance.js"></script>
|
<script src="test.performance.js"></script>
|
||||||
|
|
|
||||||
|
|
@ -225,14 +225,15 @@ describe('PublicKeyRing model', function() {
|
||||||
|
|
||||||
it('should merge backup', function() {
|
it('should merge backup', function() {
|
||||||
var w = getCachedW().w;
|
var w = getCachedW().w;
|
||||||
|
var hasChanged;
|
||||||
|
|
||||||
w.copayersBackup = ["a", "b"];
|
w.copayersBackup = ["a", "b"];
|
||||||
var hasChanged = w.mergeBackups(["b", "c"]);
|
hasChanged = w.mergeBackups(["b", "c"]);
|
||||||
w.copayersBackup.length.should.equal(3);
|
w.copayersBackup.length.should.equal(3);
|
||||||
hasChanged.should.equal(true);
|
hasChanged.should.equal(true);
|
||||||
|
|
||||||
w.copayersBackup = ["a", "b", "c"];
|
w.copayersBackup = ["a", "b", "c"];
|
||||||
var hasChanged = w.mergeBackups(["b", "c"]);
|
hasChanged = w.mergeBackups(["b", "c"]);
|
||||||
w.copayersBackup.length.should.equal(3);
|
w.copayersBackup.length.should.equal(3);
|
||||||
hasChanged.should.equal(false);
|
hasChanged.should.equal(false);
|
||||||
});
|
});
|
||||||
|
|
@ -348,9 +349,10 @@ describe('PublicKeyRing model', function() {
|
||||||
var config = {
|
var config = {
|
||||||
networkName: 'livenet',
|
networkName: 'livenet',
|
||||||
};
|
};
|
||||||
|
var copayers;
|
||||||
var w = new PublicKeyRing(config);
|
var w = new PublicKeyRing(config);
|
||||||
should.exist(w);
|
should.exist(w);
|
||||||
var copayers = [];
|
copayers = [];
|
||||||
for (var i = 0; i < 2; i++) {
|
for (var i = 0; i < 2; i++) {
|
||||||
w.isComplete().should.equal(false);
|
w.isComplete().should.equal(false);
|
||||||
w.addCopayer(getNewEpk());
|
w.addCopayer(getNewEpk());
|
||||||
|
|
@ -361,7 +363,7 @@ describe('PublicKeyRing model', function() {
|
||||||
id: w.id,
|
id: w.id,
|
||||||
});
|
});
|
||||||
should.exist(w);
|
should.exist(w);
|
||||||
var copayers = [];
|
copayers = [];
|
||||||
for (var i = 0; i < 3; i++) {
|
for (var i = 0; i < 3; i++) {
|
||||||
w2.isComplete().should.equal(false);
|
w2.isComplete().should.equal(false);
|
||||||
w2.addCopayer(getNewEpk());
|
w2.addCopayer(getNewEpk());
|
||||||
|
|
|
||||||
|
|
@ -298,7 +298,7 @@ describe('WalletFactory model', function() {
|
||||||
var w = wf.create({
|
var w = wf.create({
|
||||||
name: 'test wallet'
|
name: 'test wallet'
|
||||||
});
|
});
|
||||||
var ws = wf.getWallets();
|
ws = wf.getWallets();
|
||||||
ws.length.should.equal(1);
|
ws.length.should.equal(1);
|
||||||
ws[0].name.should.equal('test wallet');
|
ws[0].name.should.equal('test wallet');
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue