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

33 lines
1.2 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;
2019-09-13 14:09:14 +00:00
beforeEach(angular.mock.module('client', $translateProvider => {
$translateProvider.translations('en', {});
}));
beforeEach(angular.mock.inject(($componentController, _$httpBackend_) => {
2018-07-16 06:00:04 +00:00
let $stateParams = {classificationId: 1};
$httpBackend = _$httpBackend_;
controller = $componentController('vnClientCreditInsuranceInsuranceIndex', {$stateParams});
}));
describe('$onInit()', () => {
it('should perform a query to GET credit the credit classification', () => {
let res = [{finished: 'some value'}];
let query = '/client/api/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);
});
});
});
});