fix tests

This commit is contained in:
Matias Alejo Garcia 2016-06-13 10:39:28 -03:00
commit 399ab1a75f
No known key found for this signature in database
GPG key ID: 02470DB551277AB3
2 changed files with 17 additions and 15 deletions

View file

@ -150,7 +150,7 @@ angular.module('copayApp.services')
root.profile.setChecked(platformInfo.ua, credentials.walletId); root.profile.setChecked(platformInfo.ua, credentials.walletId);
return cb(null, root.bindWalletClient(client)); return cb(null, root.bindWalletClient(client));
}, 1); }, skipKeyValidation ? 50 : 0);
}; };
root.bindProfile = function(profile, cb) { root.bindProfile = function(profile, cb) {
@ -164,6 +164,8 @@ angular.module('copayApp.services')
var l = root.profile.credentials.length; var l = root.profile.credentials.length;
var i = 0, totalBound = 0; var i = 0, totalBound = 0;
if (!l) return cb();
lodash.each(root.profile.credentials, function(credentials) { lodash.each(root.profile.credentials, function(credentials) {
root.bindWallet(credentials, function(err, bound) { root.bindWallet(credentials, function(err, bound) {
i++; i++;
@ -311,21 +313,23 @@ angular.module('copayApp.services')
// Creates a wallet on BWC/BWS // Creates a wallet on BWC/BWS
var doCreateWallet = function(opts, cb) { var doCreateWallet = function(opts, cb) {
$log.debug('Creating Wallet:', opts); $log.debug('Creating Wallet:', opts);
seedWallet(opts, function(err, walletClient) { $timeout(function() {
if (err) return cb(err); seedWallet(opts, function(err, walletClient) {
if (err) return cb(err);
var name = opts.name || gettextCatalog.getString('Personal Wallet'); var name = opts.name || gettextCatalog.getString('Personal Wallet');
var myName = opts.myName || gettextCatalog.getString('me'); var myName = opts.myName || gettextCatalog.getString('me');
walletClient.createWallet(name, myName, opts.m, opts.n, { walletClient.createWallet(name, myName, opts.m, opts.n, {
network: opts.networkName, network: opts.networkName,
singleAddress: opts.singleAddress, singleAddress: opts.singleAddress,
walletPrivKey: opts.walletPrivKey, walletPrivKey: opts.walletPrivKey,
}, function(err, secret) { }, function(err, secret) {
if (err) return bwsError.cb(err, gettext('Error creating wallet'), cb); if (err) return bwsError.cb(err, gettext('Error creating wallet'), cb);
return cb(null, walletClient, secret); return cb(null, walletClient, secret);
});
}); });
}); }, 5);
}; };
// Creates the default Copay profile and its wallet // Creates the default Copay profile and its wallet
@ -634,7 +638,6 @@ angular.module('copayApp.services')
var defaults = configService.getDefaults(); var defaults = configService.getDefaults();
configService.get(function(err) { configService.get(function(err) {
root.createDefaultProfile(opts, function(err, p) { root.createDefaultProfile(opts, function(err, p) {
if (err) return cb(err); if (err) return cb(err);

View file

@ -221,7 +221,6 @@ mocks.init = function(fixtures, controllerName, opts, done) {
done(); done();
}); });
} else { } else {
_profileService_.create({ _profileService_.create({
noWallet: true noWallet: true
}, function(err) { }, function(err) {