From d3600858eea21893e77b6f85623e8f61a04467c1 Mon Sep 17 00:00:00 2001 From: Carlos Date: Tue, 29 Aug 2017 15:14:18 +0200 Subject: [PATCH] billing data copyData test --- .../src/billing-data/billing-data.spec.js | 86 +++++++------------ 1 file changed, 31 insertions(+), 55 deletions(-) diff --git a/client/client/src/billing-data/billing-data.spec.js b/client/client/src/billing-data/billing-data.spec.js index c2d3b3b24..da2e2f21d 100644 --- a/client/client/src/billing-data/billing-data.spec.js +++ b/client/client/src/billing-data/billing-data.spec.js @@ -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); + }); + }); +});