salix/modules/client/front/fiscal-data/index.spec.js

29 lines
1.1 KiB
JavaScript

import './index';
describe('Client', () => {
describe('Component vnClientFiscalData', () => {
let $httpBackend;
let $scope;
let controller;
beforeEach(ngModule('client'));
beforeEach(angular.mock.inject(($componentController, $rootScope, _$httpBackend_) => {
$httpBackend = _$httpBackend_;
$scope = $rootScope.$new();
controller = $componentController('vnClientFiscalData', {$scope});
controller.card = {reload: () => {}};
}));
describe('returnDialogEt()', () => {
it('should request to patch the propagation of tax status', () => {
controller.client = {id: 123, isEqualizated: false};
$httpBackend.when('PATCH', `Clients/${controller.client.id}/addressesPropagateRe`, {isEqualizated: controller.client.isEqualizated}).respond('done');
$httpBackend.expectPATCH(`Clients/${controller.client.id}/addressesPropagateRe`, {isEqualizated: controller.client.isEqualizated});
controller.returnDialogEt('ACCEPT');
$httpBackend.flush();
});
});
});
});