billing data copyData test

This commit is contained in:
Carlos 2017-08-29 15:14:18 +02:00
parent ca9906de33
commit d3600858ee
1 changed files with 31 additions and 55 deletions

View File

@ -1,59 +1,35 @@
// import './billing-data.js';
import './billing-data.js';
// describe('Component vnClientBillingData', () => {
// let $componentController;
// let $scope;
// let vnApp;
describe('Component vnClientBillingData', () => {
let $componentController;
let $scope;
let vnApp;
// beforeEach(() => {
// angular.mock.module('client');
// });
beforeEach(() => {
angular.mock.module('client');
});
// beforeEach(angular.mock.inject(function(_$componentController_, $rootScope, _$q_, _vnApp_) {
// $componentController = _$componentController_;
// $scope = $rootScope.$new();
// vnApp = _vnApp_;
// spyOn(vnApp, 'showError');
// }));
beforeEach(angular.mock.inject(function(_$componentController_, $rootScope, _vnApp_) {
$componentController = _$componentController_;
$scope = $rootScope.$new();
vnApp = _vnApp_;
spyOn(vnApp, 'showError');
}));
// // describe('$onChanges()', () => {
// // it(`should call copyData()`, () => {
// // });
// // });
// describe('copyData()', () => {
// it(`should pass client data to billData`, () => {
// let controller = $componentController('vnClientBillingData', {$scope: $scope});
// controller.client = {
// payMethodFk: 'this',
// iban: 'is',
// dueDay: 'basically',
// discount: 'nonsense',
// credit: 'test',
// creditInsurance: 'text!'
// };
// controller.copyData();
// expect(controller.billData).toEqual(controller.client);
// });
// });
// describe('submit()', () => {
// it(`should call submit() on the watcher then receive a callback`, () => {
// let controller = $componentController('vnClientBillingData', {$scope: $scope});
// spyOn(controller, 'submit');
// controller.submit();
// expect(controller.submit).toHaveBeenCalled();
// // controller.client = {
// // payMethodFk: 'this',
// // iban: 'is',
// // dueDay: 'basically',
// // discount: 'nonsense',
// // credit: 'test',
// // creditInsurance: 'text!'
// // };
// // controller.copyData();
// // expect(controller.billData).toEqual(controller.client);
// });
// });
// });
describe('copyData()', () => {
it(`should define billData using client's data`, () => {
let controller = $componentController('vnClientBillingData', {$scope: $scope});
controller.client = {
credit: 1000000000000,
creditInsurance: null,
discount: 99,
dueDay: 0,
iban: null,
payMethodFk: 1
};
controller.billData = {};
controller.copyData(controller.client);
expect(controller.billData).toEqual(controller.client);
});
});
});