salix/modules/client/front/credit-insurance/insurance/index/index.spec.js

34 lines
1.3 KiB
JavaScript
Raw Normal View History

2018-05-23 12:26:51 +00:00
import './index';
describe('Client', () => {
describe('Component vnClientCreditInsuranceInsuranceIndex', () => {
let controller;
let $httpBackend;
2020-03-17 10:17:50 +00:00
let $scope;
beforeEach(ngModule('client'));
2020-07-23 14:46:16 +00:00
beforeEach(inject(($componentController, _$httpBackend_, $rootScope) => {
2020-03-17 10:17:50 +00:00
$scope = $rootScope.$new();
$httpBackend = _$httpBackend_;
2020-03-17 10:17:50 +00:00
const $element = angular.element('<vn-client-credit-insurance-insurance-index></vn-client-credit-insurance-insurance-index>');
controller = $componentController('vnClientCreditInsuranceInsuranceIndex', {$element, $scope});
controller.$params = {classificationId: 1};
}));
describe('$onInit()', () => {
it('should perform a query to GET credit the credit classification', () => {
let res = [{finished: 'some value'}];
let query = 'CreditClassifications?filter=%7B%22fields%22%3A%5B%22finished%22%5D%2C%22where%22%3A%7B%22id%22%3A1%7D%7D';
$httpBackend.whenGET(query).respond(res);
$httpBackend.expectGET(query);
controller.$onInit();
$httpBackend.flush();
expect(controller.isClosed).toBe(true);
});
});
});
});