Test for profile backups. Update travis.yaml
This commit is contained in:
parent
6dfc59c523
commit
96131ed16b
3 changed files with 66 additions and 14 deletions
12
.travis.yml
12
.travis.yml
|
|
@ -7,15 +7,5 @@ before_install:
|
||||||
- export DISPLAY=:99.0
|
- export DISPLAY=:99.0
|
||||||
- sh -e /etc/init.d/xvfb start
|
- sh -e /etc/init.d/xvfb start
|
||||||
install:
|
install:
|
||||||
- npm install
|
|
||||||
- bower install
|
- bower install
|
||||||
before_script:
|
- npm install
|
||||||
- grunt
|
|
||||||
notifications:
|
|
||||||
hipchat:
|
|
||||||
rooms:
|
|
||||||
secure: ibsyaK2/7hdms9pRHCibamfUtA1yb5Ib3tIQOChwnfNSkpOy5ZViuq92duPZpKacgNuRmiwp6wfbDY8duLiadwnCet4V3dHAGqt+t9o+O7A9DzxNeYFFHnnrhqhg95PjWK6UyFqrQajPIr+n11M2itEQLa7kljQxJZ3Z26zJCdI=
|
|
||||||
template:
|
|
||||||
- '%{repository}#%{build_number} (%{branch} - %{commit} : %{author}): %{message} (<a href="%{build_url}">Details</a>/<a href="%{compare_url}">Change view</a>)'
|
|
||||||
format: html
|
|
||||||
on_success: never
|
|
||||||
|
|
|
||||||
|
|
@ -46,7 +46,9 @@ angular.module('copayApp.services')
|
||||||
};
|
};
|
||||||
|
|
||||||
root.onError = function(scope) {
|
root.onError = function(scope) {
|
||||||
if (scope) scope.loading = false;
|
if (scope) {
|
||||||
|
scope.loading = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
root.onErrorDigest = function(scope, msg) {
|
root.onErrorDigest = function(scope, msg) {
|
||||||
|
|
|
||||||
|
|
@ -41,11 +41,11 @@ describe("Unit: Controllers", function() {
|
||||||
|
|
||||||
beforeEach(inject(function($controller, $rootScope) {
|
beforeEach(inject(function($controller, $rootScope) {
|
||||||
scope = $rootScope.$new();
|
scope = $rootScope.$new();
|
||||||
$rootScope.iden = sinon.stub();
|
|
||||||
$rootScope.safeUnspentCount = 1;
|
$rootScope.safeUnspentCount = 1;
|
||||||
$rootScope.pendingTxCount = 0;
|
$rootScope.pendingTxCount = 0;
|
||||||
|
|
||||||
var w = {};
|
var w = {};
|
||||||
|
w.id = 1234;
|
||||||
w.isReady = sinon.stub().returns(true);
|
w.isReady = sinon.stub().returns(true);
|
||||||
w.privateKey = {};
|
w.privateKey = {};
|
||||||
w.settings = {
|
w.settings = {
|
||||||
|
|
@ -77,8 +77,25 @@ describe("Unit: Controllers", function() {
|
||||||
txs : [{ isPending : true }],
|
txs : [{ isPending : true }],
|
||||||
pendingForUs: 1
|
pendingForUs: 1
|
||||||
});
|
});
|
||||||
|
w.getId = sinon.stub().returns(1234);
|
||||||
|
w.on = sinon.stub().yields({'e': 'errmsg', 'loading': false});
|
||||||
|
w.getBalance = sinon.stub().returns(10000);
|
||||||
|
w.publicKeyRing = sinon.stub().yields(null);
|
||||||
|
w.publicKeyRing.nicknameForCopayer = sinon.stub().returns('nickcopayer');
|
||||||
|
w.updateFocusedTimestamp = sinon.stub().returns(1415804323);
|
||||||
|
w.getAddressesInfo = sinon.stub().returns([
|
||||||
|
{ addressStr: "2MxvwvfshZxw4SkkaJZ8NDKLyepa9HLMKtu",
|
||||||
|
isChange: false }
|
||||||
|
]);
|
||||||
|
|
||||||
|
var iden = {};
|
||||||
|
iden.deleteWallet = sinon.stub().yields(null);
|
||||||
|
iden.getLastFocusedWallet = sinon.stub().returns(null);
|
||||||
|
iden.listWallets = sinon.stub().returns([w]);
|
||||||
|
iden.getWalletById = sinon.stub().returns(w);
|
||||||
|
|
||||||
$rootScope.wallet = w;
|
$rootScope.wallet = w;
|
||||||
|
$rootScope.iden = iden;
|
||||||
}));
|
}));
|
||||||
|
|
||||||
describe('Create Controller', function() {
|
describe('Create Controller', function() {
|
||||||
|
|
@ -579,4 +596,47 @@ describe("Unit: Controllers", function() {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe('Profile Controller', function() {
|
||||||
|
var ctrl, scope;
|
||||||
|
beforeEach(inject(function($controller, $rootScope) {
|
||||||
|
scope = $rootScope.$new();
|
||||||
|
ctrl = $controller('ProfileController', {
|
||||||
|
$scope: scope,
|
||||||
|
$modal: {},
|
||||||
|
});
|
||||||
|
saveAsLastCall = null;
|
||||||
|
}));
|
||||||
|
|
||||||
|
it('Backup Wallet controller #download', function() {
|
||||||
|
var w = scope.wallet;
|
||||||
|
expect(saveAsLastCall).equal(null);
|
||||||
|
scope.downloadWalletBackup(w);
|
||||||
|
expect(saveAsLastCall.blob.size).equal(7);
|
||||||
|
expect(saveAsLastCall.blob.type).equal('text/plain;charset=utf-8');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Backup Wallet controller should name backup correctly for multiple copayers', function() {
|
||||||
|
var w = scope.wallet;
|
||||||
|
expect(saveAsLastCall).equal(null);
|
||||||
|
scope.downloadWalletBackup(w);
|
||||||
|
expect(saveAsLastCall.filename).equal('nickname-fakeWallet-keybackup.json.aes');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Backup Wallet controller should name backup correctly for 1-1 wallet', function() {
|
||||||
|
var w = scope.wallet;
|
||||||
|
expect(saveAsLastCall).equal(null);
|
||||||
|
scope.wallet.totalCopayers = 1;
|
||||||
|
scope.downloadWalletBackup(w);
|
||||||
|
expect(saveAsLastCall.filename).equal('fakeWallet-keybackup.json.aes');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Delete a wallet', function() {
|
||||||
|
var w = scope.wallet;
|
||||||
|
scope.deleteWallet(w);
|
||||||
|
scope.$digest();
|
||||||
|
expect(scope.wallet).equal(null);
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue