diff --git a/client/client/src/address-edit/address-edit.spec.js b/client/client/src/address-edit/address-edit.spec.js index 129708241..5d4ad71be 100644 --- a/client/client/src/address-edit/address-edit.spec.js +++ b/client/client/src/address-edit/address-edit.spec.js @@ -5,14 +5,16 @@ describe('Client', () => { let $componentController; let $state; let controller; + let $httpBackend; beforeEach(() => { angular.mock.module('client'); }); - beforeEach(angular.mock.inject((_$componentController_, _$state_) => { + beforeEach(angular.mock.inject((_$componentController_, _$state_, _$httpBackend_) => { $componentController = _$componentController_; $state = _$state_; + $httpBackend = _$httpBackend_; $state.params.addressId = '1234'; controller = $componentController('vnAddressEdit', {$state: $state}); })); @@ -20,5 +22,16 @@ describe('Client', () => { it('should define and set address property', () => { expect(controller.address.id).toBe(1234); }); + + describe('$onInit()', () => { + it('should perform a GET query to receive the address observations', () => { + let filter = {where: {addressFk: 1234}, include: [{relation: 'observationType'}]}; + let json = {data: 'some notes'}; + $httpBackend.when('GET', `/client/api/AddressObservations?filter=${JSON.stringify(filter)}`).respond(json); + $httpBackend.expectGET(`/client/api/AddressObservations?filter=${JSON.stringify(filter)}`); + controller.$onInit(); + $httpBackend.flush(); + }); + }); }); }); diff --git a/client/client/src/fiscal-data/fiscal-data.spec.js b/client/client/src/fiscal-data/fiscal-data.spec.js new file mode 100644 index 000000000..653029c6f --- /dev/null +++ b/client/client/src/fiscal-data/fiscal-data.spec.js @@ -0,0 +1,31 @@ +import './fiscal-data.js'; + +describe('Client', () => { + describe('Component vnClientFiscalData', () => { + let $componentController; + let $httpBackend; + let $scope; + let controller; + + beforeEach(() => { + angular.mock.module('client'); + }); + + beforeEach(angular.mock.inject((_$componentController_, $rootScope, _$httpBackend_) => { + $componentController = _$componentController_; + $httpBackend = _$httpBackend_; + $scope = $rootScope.$new(); + controller = $componentController('vnClientFiscalData', {$scope: $scope}); + })); + + describe('returnDialogEt()', () => { + it('should request to patch the propagation of tax status', () => { + controller.client = {id: 123, isEqualizated: false}; + $httpBackend.when('PATCH', `/client/api/Clients/${controller.client.id}/addressesPropagateRe`, {isEqualizated: controller.client.isEqualizated}).respond('done'); + $httpBackend.expectPATCH(`/client/api/Clients/${controller.client.id}/addressesPropagateRe`, {isEqualizated: controller.client.isEqualizated}); + controller.returnDialogEt('ACCEPT'); + $httpBackend.flush(); + }); + }); + }); +}); diff --git a/client/client/src/search-panel/search-panel.spec.js b/client/client/src/search-panel/search-panel.spec.js deleted file mode 100644 index 43c520b82..000000000 --- a/client/client/src/search-panel/search-panel.spec.js +++ /dev/null @@ -1,41 +0,0 @@ -import './search-panel.js'; - -describe('Client', () => { - describe('Component vnClientSearchPanel', () => { - let $componentController; - let sessionStorage; - let controller; - - beforeEach(() => { - angular.mock.module('client'); - }); - - beforeEach(angular.mock.inject((_$componentController_, _sessionStorage_) => { - $componentController = _$componentController_; - sessionStorage = _sessionStorage_; - controller = $componentController('vnClientSearchPanel', {sessionStorage: sessionStorage}); - })); - - // describe('onSearch()', () => { - // it('should call setStorageValue() and onSubmit()', () => { - // spyOn(controller, 'setStorageValue'); - // spyOn(controller, 'onSubmit'); - // controller.setStorageValue(); - // controller.onSubmit(); - - // expect(controller.setStorageValue).toHaveBeenCalledWith(); - // expect(controller.onSubmit).toHaveBeenCalledWith(); - // }); - // }); - - // describe('$onChanges()', () => { - // it('should set filter properties using the search values', () => { - // expect(controller.filter).not.toBeDefined(); - // spyOn(sessionStorage, 'get').and.returnValue({data: 'data'}); - // controller.$onChanges(); - - // expect(controller.filter).toBe(sessionStorage.get({data: 'data'})); - // }); - // }); - }); -}); diff --git a/package-lock.json b/package-lock.json index 8eee2975c..9988603b0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -113,7 +113,7 @@ "angular": { "version": "1.6.8", "resolved": "https://registry.npmjs.org/angular/-/angular-1.6.8.tgz", - "integrity": "sha512-9WErZIOw1Cu1V5Yxdvxz/6YpND8ntdP71fdPpufPFJvZodZXqCjQBYrHqEoMZreO5i84O3D/Jw/vepoFt68Azw==" + "integrity": "sha1-W+N4pYvpGlSJ54tZxFGM2f0nP/s=" }, "angular-cookies": { "version": "1.6.4", @@ -1119,7 +1119,7 @@ "bluebird": { "version": "3.5.1", "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.5.1.tgz", - "integrity": "sha512-MKiLiV+I1AA596t9w1sQJ8jkiSr5+ZKi0WKrYGUn6d1Fx+Ij4tIj+m2WMQSGczs5jZVxV339chE8iwk6F64wjA==", + "integrity": "sha1-2VUfnemPH82h5oPRfukaBgLuLrk=", "dev": true }, "bn.js": { @@ -5328,7 +5328,7 @@ "fsevents": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-1.1.3.tgz", - "integrity": "sha512-WIr7iDkdmdbxu/Gh6eKEZJL6KPE74/5MEsf2whTOFNxbIoIixogroLdKYqB6FDav4Wavh/lZdzzd3b2KxIXC5Q==", + "integrity": "sha1-EfgjGPX+e7LNIpZaEI6TBiCCFtg=", "dev": true, "optional": true, "requires": { @@ -9909,7 +9909,7 @@ "jasmine-spec-reporter": { "version": "4.2.1", "resolved": "https://registry.npmjs.org/jasmine-spec-reporter/-/jasmine-spec-reporter-4.2.1.tgz", - "integrity": "sha512-FZBoZu7VE5nR7Nilzy+Np8KuVIOxF4oXDPDknehCYBDE080EnlPu0afdZNmpGDBRCUBv3mj5qgqCRmk6W/K8vg==", + "integrity": "sha1-HWMq7ANBZwrTJPkrqEtLMrNeniI=", "dev": true, "requires": { "colors": "1.1.2" @@ -10051,7 +10051,7 @@ "karma": { "version": "1.7.1", "resolved": "https://registry.npmjs.org/karma/-/karma-1.7.1.tgz", - "integrity": "sha512-k5pBjHDhmkdaUccnC7gE3mBzZjcxyxYsYVaqiL2G5AqlfLyBO5nw2VdNK+O16cveEPd/gIOWULH7gkiYYwVNHg==", + "integrity": "sha1-hcwI6eCiLXzpzKN8ShvoJPaisa4=", "dev": true, "requires": { "bluebird": "3.5.1", @@ -10113,7 +10113,7 @@ "karma-firefox-launcher": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/karma-firefox-launcher/-/karma-firefox-launcher-1.1.0.tgz", - "integrity": "sha512-LbZ5/XlIXLeQ3cqnCbYLn+rOVhuMIK9aZwlP6eOLGzWdo1UVp7t6CN3DP4SafiRLjexKwHeKHDm0c38Mtd3VxA==", + "integrity": "sha1-LEcDBFLwRTHrfRPU/HZpYwu5Mzk=", "dev": true }, "karma-jasmine": { @@ -14654,7 +14654,7 @@ "useragent": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/useragent/-/useragent-2.3.0.tgz", - "integrity": "sha512-4AoH4pxuSvHCjqLO04sU6U/uE65BYza8l/KKBS0b0hnUPWi+cQ2BpeTEwejCSx9SPV5/U03nniDTrWx5NrmKdw==", + "integrity": "sha1-IX+UOtVAyyEoZYqyP8lg9qiMmXI=", "dev": true, "requires": { "lru-cache": "4.1.1", diff --git a/services_tests.js b/services_tests.js index b64bda5ed..0ce869843 100644 --- a/services_tests.js +++ b/services_tests.js @@ -18,8 +18,8 @@ jasmine.loadConfig({ spec_dir: 'services', spec_files: [ 'auth/server/**/*[sS]pec.js', - 'loopback/common/**/*[sS]pec.js', - 'client/common/**/*[sS]pec.js' + 'client/common/**/*[sS]pec.js', + 'loopback/common/**/*[sS]pec.js' ], helpers: [ '/services/utils/jasmineHelpers.js'