diff --git a/.travis.yml b/.travis.yml
index b9ec22cd7..4ee85c8dd 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,21 +1,11 @@
language: node_js
node_js:
-- '0.10'
+ - '0.10'
before_install:
- npm install -g bower
- npm install -g grunt-cli
- export DISPLAY=:99.0
- sh -e /etc/init.d/xvfb start
install:
- - npm install
- bower install
-before_script:
- - grunt
-notifications:
- hipchat:
- rooms:
- secure: ibsyaK2/7hdms9pRHCibamfUtA1yb5Ib3tIQOChwnfNSkpOy5ZViuq92duPZpKacgNuRmiwp6wfbDY8duLiadwnCet4V3dHAGqt+t9o+O7A9DzxNeYFFHnnrhqhg95PjWK6UyFqrQajPIr+n11M2itEQLa7kljQxJZ3Z26zJCdI=
- template:
- - '%{repository}#%{build_number} (%{branch} - %{commit} : %{author}): %{message} (Details/Change view)'
- format: html
- on_success: never
+ - npm install
diff --git a/js/services/controllerUtils.js b/js/services/controllerUtils.js
index d8c013283..d7ff433cf 100644
--- a/js/services/controllerUtils.js
+++ b/js/services/controllerUtils.js
@@ -46,7 +46,9 @@ angular.module('copayApp.services')
};
root.onError = function(scope) {
- if (scope) scope.loading = false;
+ if (scope) {
+ scope.loading = false;
+ }
}
root.onErrorDigest = function(scope, msg) {
diff --git a/test/unit/controllers/controllersSpec.js b/test/unit/controllers/controllersSpec.js
index 10dc77fac..baac81a13 100644
--- a/test/unit/controllers/controllersSpec.js
+++ b/test/unit/controllers/controllersSpec.js
@@ -41,11 +41,11 @@ describe("Unit: Controllers", function() {
beforeEach(inject(function($controller, $rootScope) {
scope = $rootScope.$new();
- $rootScope.iden = sinon.stub();
$rootScope.safeUnspentCount = 1;
$rootScope.pendingTxCount = 0;
var w = {};
+ w.id = 1234;
w.isReady = sinon.stub().returns(true);
w.privateKey = {};
w.settings = {
@@ -77,8 +77,25 @@ describe("Unit: Controllers", function() {
txs : [{ isPending : true }],
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.iden = iden;
}));
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);
+ });
+
+ });
+
});