2018-08-09 10:54:29 +00:00
|
|
|
import './index';
|
|
|
|
|
|
|
|
describe('Client', () => {
|
|
|
|
describe('Component vnClientCreditInsuranceCreate', () => {
|
|
|
|
let controller;
|
|
|
|
let $scope;
|
|
|
|
let $httpBackend;
|
|
|
|
|
2019-10-24 22:53:53 +00:00
|
|
|
beforeEach(ngModule('client'));
|
2018-08-09 10:54:29 +00:00
|
|
|
|
2020-07-23 14:46:16 +00:00
|
|
|
beforeEach(inject(($componentController, $rootScope, _$httpBackend_) => {
|
2018-08-09 10:54:29 +00:00
|
|
|
$httpBackend = _$httpBackend_;
|
|
|
|
$scope = $rootScope.$new();
|
|
|
|
$scope.form = {
|
|
|
|
$invalid: false
|
|
|
|
};
|
2020-03-17 10:17:50 +00:00
|
|
|
const $element = angular.element('<vn-client-credit-insurance-create></vn-client-credit-insurance-create>');
|
|
|
|
controller = $componentController('vnClientCreditInsuranceCreate', {$element, $scope});
|
2021-06-23 11:24:23 +00:00
|
|
|
controller.client = {id: 1101};
|
2018-08-09 10:54:29 +00:00
|
|
|
controller.card = {
|
|
|
|
reload: () => {}
|
|
|
|
};
|
|
|
|
}));
|
|
|
|
|
|
|
|
describe('onSubmit()', () => {
|
|
|
|
it('should perform a POST query', () => {
|
2023-01-16 14:18:24 +00:00
|
|
|
let started = Date.vnNew();
|
2018-08-09 10:54:29 +00:00
|
|
|
controller.creditClassification = {
|
2018-08-23 08:08:06 +00:00
|
|
|
started: started,
|
2018-08-09 10:54:29 +00:00
|
|
|
credit: 300,
|
|
|
|
grade: 1
|
|
|
|
};
|
|
|
|
|
|
|
|
let newData = {
|
2018-08-23 08:08:06 +00:00
|
|
|
started: started,
|
2018-08-09 10:54:29 +00:00
|
|
|
credit: 300,
|
|
|
|
grade: 1,
|
2021-06-23 11:24:23 +00:00
|
|
|
clientFk: 1101
|
2018-08-09 10:54:29 +00:00
|
|
|
};
|
|
|
|
|
2019-10-24 22:53:53 +00:00
|
|
|
$httpBackend.whenPOST(`creditClassifications/createWithInsurance`, newData).respond(200, true);
|
|
|
|
$httpBackend.expectPOST(`creditClassifications/createWithInsurance`, newData);
|
2018-08-09 10:54:29 +00:00
|
|
|
controller.onSubmit();
|
|
|
|
$httpBackend.flush();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|