Add controller tests (#4205)

* add walletHome test template

* add create test

* add fixtures

* do not mock parseSecret

* better hash

* use fixtures for create controller test

* add import test

* stubs reset

* add more controller tests

* Remove $state dependency

* refactore fixtures + profiles

* add backup.js test

* update bwc

* rm log
This commit is contained in:
Matias Alejo Garcia 2016-05-20 11:50:55 -03:00
commit aec2aac47b
20 changed files with 2265 additions and 28 deletions

View file

@ -1,6 +1,6 @@
'use strict';
angular.module('copayApp.controllers').controller('indexController', function($rootScope, $scope, $log, $filter, $timeout, latestReleaseService, bwcService, pushNotificationsService, lodash, go, profileService, configService, isCordova, rateService, storageService, addressService, gettext, gettextCatalog, amMoment, nodeWebkit, addonManager, isChromeApp, bwsError, txFormatService, uxLanguage, $state, glideraService, coinbaseService, isMobile, addressbookService, walletService) {
angular.module('copayApp.controllers').controller('indexController', function($rootScope, $scope, $log, $filter, $timeout, latestReleaseService, bwcService, pushNotificationsService, lodash, go, profileService, configService, isCordova, rateService, storageService, addressService, gettext, gettextCatalog, amMoment, nodeWebkit, addonManager, isChromeApp, bwsError, txFormatService, uxLanguage, glideraService, coinbaseService, isMobile, addressbookService, walletService) {
var self = this;
var SOFT_CONFIRMATION_LIMIT = 12;
var errors = bwcService.getErrors();
@ -156,7 +156,7 @@ angular.module('copayApp.controllers').controller('indexController', function($r
$log.debug('Wallet not complete BEFORE update... redirecting');
go.path('copayers');
} else {
if ($state.is('copayers')) {
if (go.is('copayers')) {
$log.debug('Wallet Complete BEFORE update... redirect to home');
go.walletHome();
}
@ -169,7 +169,7 @@ angular.module('copayApp.controllers').controller('indexController', function($r
$log.debug('Wallet not complete after update... redirecting');
go.path('copayers');
} else {
if ($state.is('copayers')) {
if (go.is('copayers')) {
$log.debug('Wallet Complete after update... redirect to home');
go.walletHome();
}
@ -211,7 +211,7 @@ angular.module('copayApp.controllers').controller('indexController', function($r
}, 300);
}
if (!self.tab || !$state.is('walletHome'))
if (!self.tab || go.is('walletHome'))
self.tab = 'walletHome';
var changeTab = function() {
@ -235,7 +235,7 @@ angular.module('copayApp.controllers').controller('indexController', function($r
$rootScope.$emit('Local/TabChanged', tab);
};
if (switchState && !$state.is('walletHome')) {
if (switchState && go.is('walletHome')) {
go.path('walletHome', function() {
changeTab();
});