fix karma test

This commit is contained in:
Gustavo Maximiliano Cortez 2015-01-14 17:06:13 -03:00
parent e7c6422770
commit 3a8717a1f4
1 changed files with 8 additions and 25 deletions

View File

@ -568,25 +568,12 @@ describe("Unit: Controllers", function() {
}); });
}); });
describe('Profile Controller', function() { describe('More Controller', function() {
var ctrl, inScope, modalCtrl; var ctrl, modalCtrl;
beforeEach(inject(function($controller, $rootScope) { beforeEach(inject(function($controller, $rootScope) {
scope = $rootScope.$new(); scope = $rootScope.$new();
ctrl = $controller('ProfileController', { ctrl = $controller('MoreController', {
$scope: scope, $scope: scope
$modal: {
open: function(opts) {
inScope = $rootScope.$new();
modalCtrl = opts.controller(inScope, {
close: sinon.stub(),
});
return {
result: {
then: sinon.stub(),
}
};
},
},
}); });
saveAsLastCall = null; saveAsLastCall = null;
@ -595,8 +582,7 @@ describe("Unit: Controllers", function() {
it('Backup Wallet controller #download', function() { it('Backup Wallet controller #download', function() {
var w = scope.wallet; var w = scope.wallet;
expect(saveAsLastCall).equal(null); expect(saveAsLastCall).equal(null);
scope.showWalletInfo(w); scope.downloadWalletBackup();
inScope.downloadWalletBackup();
expect(saveAsLastCall.blob.size).equal(7); expect(saveAsLastCall.blob.size).equal(7);
expect(saveAsLastCall.blob.type).equal('text/plain;charset=utf-8'); expect(saveAsLastCall.blob.type).equal('text/plain;charset=utf-8');
@ -605,8 +591,7 @@ describe("Unit: Controllers", function() {
it('Backup Wallet controller should name backup correctly for multiple copayers', function() { it('Backup Wallet controller should name backup correctly for multiple copayers', function() {
var w = scope.wallet; var w = scope.wallet;
expect(saveAsLastCall).equal(null); expect(saveAsLastCall).equal(null);
scope.showWalletInfo(w); scope.downloadWalletBackup();
inScope.downloadWalletBackup();
expect(saveAsLastCall.filename).equal('nickname-fakeWallet-keybackup.json.aes'); expect(saveAsLastCall.filename).equal('nickname-fakeWallet-keybackup.json.aes');
}); });
@ -614,16 +599,14 @@ describe("Unit: Controllers", function() {
var w = scope.wallet; var w = scope.wallet;
expect(saveAsLastCall).equal(null); expect(saveAsLastCall).equal(null);
scope.wallet.totalCopayers = 1; scope.wallet.totalCopayers = 1;
scope.showWalletInfo(w); scope.downloadWalletBackup();
inScope.downloadWalletBackup();
expect(saveAsLastCall.filename).equal('fakeWallet-keybackup.json.aes'); expect(saveAsLastCall.filename).equal('fakeWallet-keybackup.json.aes');
}); });
it('Delete a wallet', function() { it('Delete a wallet', function() {
var w = scope.wallet; var w = scope.wallet;
scope.showWalletInfo(w); scope.deleteWallet();
inScope.deleteWallet();
scope.$digest(); scope.$digest();
scope.iden.deleteWallet.calledOnce.should.equal(true); scope.iden.deleteWallet.calledOnce.should.equal(true);
scope.iden.deleteWallet.getCall(0).args[0].should.equal(w.getId()); scope.iden.deleteWallet.getCall(0).args[0].should.equal(w.getId());