diff --git a/client/client/src/address-create/address-create.spec.js b/client/client/src/address-create/address-create.spec.js index 3cf93e34e..7658e7972 100644 --- a/client/client/src/address-create/address-create.spec.js +++ b/client/client/src/address-create/address-create.spec.js @@ -1,48 +1,23 @@ -//TEST PENDING DUE TO MISSING TRIGGER ON FORM SUBMIT. +import './address-create.js'; -// import './address-create.js'; +describe('Component vnAddressCreate', () => { + let $componentController; + let $state; -// describe('Component vnAddressCreate', () => { -// let $componentController; -// let $state; -// let $scope; -// let $httpBackend; -// let vnApp; + beforeEach(() => { + angular.mock.module('client'); + }); -// beforeEach(() => { -// angular.mock.module('client'); -// }); - -// beforeEach(angular.mock.inject(function(_$componentController_, $rootScope, _$httpBackend_,_$state_, _vnApp_) { -// $componentController = _$componentController_; -// $scope = $rootScope.$new(); -// $httpBackend = _$httpBackend_; -// $state = _$state_; -// vnApp = _vnApp_; -// spyOn(vnApp, 'showError'); -// })); - -// it('should request to update the password', function() { -// let controller = $componentController('vnAddressCreate', {$httpBackend: $httpBackend, $scope: $scope, $state: $state}); -// controller.address = { -// agencyFk: 23, -// city: "Valencia", -// clientFk: 3, -// consignee: "sd", -// enabled: false, -// id: 22490, -// mobile: "123456789", -// phone: "98765432", -// postcode: "12345", -// provinceFk: 63, -// street: "a" -// }; -// $httpBackend.when('PATCH', '/client/api/Addresses/3').respond('done'); -// $httpBackend.expectPATCH('/client/api/Addresses/3', { -// clientFk: 3, -// enabled: true -// }); -// $httpBackend.flush(); -// }); -// }); + beforeEach(angular.mock.inject(function(_$componentController_, _$state_) { + $componentController = _$componentController_; + $state = _$state_; + $state.params.id = '1234'; + })); + it('should define and set address property', () => { + let controller = $componentController('vnAddressCreate', {$state: $state}); + expect(controller.address).toBeDefined(); + expect(controller.address.clientFk).toBe(1234); + expect(controller.address.enabled).toBe(true); + }); +}); diff --git a/client/client/src/address-edit/address-edit.spec.js b/client/client/src/address-edit/address-edit.spec.js new file mode 100644 index 000000000..124df665d --- /dev/null +++ b/client/client/src/address-edit/address-edit.spec.js @@ -0,0 +1,24 @@ +import './address-edit.js'; + +describe('Component vnAddressEdit', () => { + let $componentController; + let $scope; + let $state; + + beforeEach(() => { + angular.mock.module('client'); + }); + + beforeEach(angular.mock.inject(function(_$componentController_, $rootScope, _$state_) { + $componentController = _$componentController_; + $scope = $scope; + $state = _$state_; + $state.params.addressId = '1234'; + })); + + it('should define and set address property', () => { + let controller = $componentController('vnAddressEdit', {$state: $state}); + expect(controller.address).toBeDefined(); + expect(controller.address.id).toBe(1234); + }); +});