Refactory ControllerSpect for test is now more clear. A simple test for transactions.

This commit is contained in:
Gustavo Cortez 2014-06-04 11:24:49 -03:00
parent 82893c703a
commit dbdd3c3500
1 changed files with 36 additions and 44 deletions

View File

@ -3,59 +3,51 @@
// //
describe("Unit: Testing Controllers", function() { describe("Unit: Testing Controllers", function() {
beforeEach(module('notifications')); var scope;
beforeEach(module('copayApp.services'));
beforeEach(module('copayApp.controllers'));
var scope, addressCtrl; beforeEach(module('notifications'));
// beforeEach(module('copayApp.services'));
beforeEach(module('copayApp.controllers'));
describe('Address Controller', function() {
var addressCtrl;
beforeEach(inject(function($controller, $rootScope) { beforeEach(inject(function($controller, $rootScope) {
scope = $rootScope.$new(); scope = $rootScope.$new();
addressCtrl = $controller('AddressesController', { addressCtrl = $controller('AddressesController', {
$scope: scope, $scope: scope,
}); });
})); }));
it('should have a AddressesController controller', function() {
expect(scope.loading).equal(false);
});
it('should have a AddressesController controller', function() { it('selectedAddr should modify scope', function() {
expect(scope.loading).equal(false); expect(scope.selectedAddress).equal(undefined);
}); scope.selectAddress('hola');
expect(scope.selectedAddr).equal('hola');
});
it('selectedAddr should modify scope', function() { });
expect(scope.selectedAddress).equal(undefined);
scope.selectAddress('hola');
expect(scope.selectedAddr).equal('hola');
});
// describe('Transactions Controller', function() {
// it('should have a BackupController controller', function() { var transactionCtrl;
// expect(copayApp.Backupcontroller).not.to.equal(null); beforeEach(inject(function($controller, $rootScope) {
// }); scope = $rootScope.$new();
// transactionsCtrl = $controller('TransactionsController', {
// it('should have a HeaderController controller', function() { $scope: scope,
// expect(copayApp.HeaderController).not.to.equal(null); });
// }); }));
//
// it('should have a SendController controller', function() { it('should have a TransactionController controller', function() {
// expect(copayApp.SendController).not.to.equal(null); expect(scope.loading).equal(false);
// }); });
//
// it('should have a SetupController controller', function() { it('should return an empty array of tx', function() {
// expect(copayApp.SetupController).not.to.equal(null); scope.getTransactions();
// }); expect(scope.blockchain_txs).to.be.empty;
// console.log('asdfasdf', scope.blockchain_txs);
// it('should have a SigninController controller', function() { });
// expect(copayApp.SigninController).not.to.equal(null);
// console.log('[controllersSpec.js.30:copayApp:]',copayApp); //TODO });
// });
//
// it('should have a TransactionsController controller', function() {
// expect(copayApp.TransactionsController).not.to.equal(null);
// });
//
// beforeEach(angular.mock.module('copay.walletFactory'));
// it('should display a link to create a new wallet if no wallets in localStorage', inject(function(walletFactory) {
// expect(walletFactory.storage.getWalletIds()).to.be.empty;
// }));
}); });