No copayer nickname on 1-1 wallets
This commit is contained in:
parent
7cf2a474dd
commit
8d7e420524
2 changed files with 11 additions and 3 deletions
|
|
@ -10,14 +10,14 @@ BackupService.prototype.getName = function(wallet) {
|
||||||
};
|
};
|
||||||
|
|
||||||
BackupService.prototype.getCopayer = function(wallet) {
|
BackupService.prototype.getCopayer = function(wallet) {
|
||||||
return wallet.getMyCopayerNickname();
|
return wallet.totalCopayers > 1 ? wallet.getMyCopayerNickname() : '';
|
||||||
};
|
};
|
||||||
|
|
||||||
BackupService.prototype.download = function(wallet) {
|
BackupService.prototype.download = function(wallet) {
|
||||||
var ew = wallet.toEncryptedObj();
|
var ew = wallet.toEncryptedObj();
|
||||||
var walletName = this.getName(wallet);
|
var walletName = this.getName(wallet);
|
||||||
var copayerName = this.getCopayer(wallet);
|
var copayerName = this.getCopayer(wallet);
|
||||||
var filename = copayerName + '-' + walletName + '-keybackup.json.aes';
|
var filename = (copayerName ? copayerName + '-' : '') + walletName + '-keybackup.json.aes';
|
||||||
|
|
||||||
this.notifications.success('Backup created', 'Encrypted backup file saved.');
|
this.notifications.success('Backup created', 'Encrypted backup file saved.');
|
||||||
var blob = new Blob([ew], {
|
var blob = new Blob([ew], {
|
||||||
|
|
|
||||||
|
|
@ -57,13 +57,21 @@ describe("Unit: Controllers", function() {
|
||||||
expect(saveAsLastCall.blob.type).equal('text/plain;charset=utf-8');
|
expect(saveAsLastCall.blob.type).equal('text/plain;charset=utf-8');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Backup controller should name backup correctly', function() {
|
it('Backup controller should name backup correctly for multiple copayers', function() {
|
||||||
scope.wallet.setEnc('1234567');
|
scope.wallet.setEnc('1234567');
|
||||||
expect(saveAsLastCall).equal(null);
|
expect(saveAsLastCall).equal(null);
|
||||||
scope.downloadBackup();
|
scope.downloadBackup();
|
||||||
expect(saveAsLastCall.filename).equal('myNickname-myTESTwullet-testID-keybackup.json.aes');
|
expect(saveAsLastCall.filename).equal('myNickname-myTESTwullet-testID-keybackup.json.aes');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('Backup controller should name backup correctly for 1-1 wallet', function() {
|
||||||
|
scope.wallet.setEnc('1234567');
|
||||||
|
expect(saveAsLastCall).equal(null);
|
||||||
|
scope.wallet.totalCopayers = 1;
|
||||||
|
scope.downloadBackup();
|
||||||
|
expect(saveAsLastCall.filename).equal('myTESTwullet-testID-keybackup.json.aes');
|
||||||
|
});
|
||||||
|
|
||||||
it('Backup controller #delete', function() {
|
it('Backup controller #delete', function() {
|
||||||
expect(scope.wallet).not.equal(undefined);
|
expect(scope.wallet).not.equal(undefined);
|
||||||
scope.deleteWallet();
|
scope.deleteWallet();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue