2018-05-23 12:26:51 +00:00
|
|
|
import './index';
|
2018-04-22 15:17:24 +00:00
|
|
|
|
|
|
|
describe('Client', () => {
|
2018-05-24 13:02:38 +00:00
|
|
|
describe('Component vnClientCreditInsuranceInsuranceIndex', () => {
|
2018-04-22 15:17:24 +00:00
|
|
|
let controller;
|
|
|
|
let $httpBackend;
|
|
|
|
|
2018-12-22 10:59:26 +00:00
|
|
|
beforeEach(ngModule('client'));
|
2018-04-22 15:17:24 +00:00
|
|
|
|
2018-12-22 10:59:26 +00:00
|
|
|
beforeEach(angular.mock.inject(($componentController, _$httpBackend_) => {
|
2018-07-16 06:00:04 +00:00
|
|
|
let $stateParams = {classificationId: 1};
|
2018-04-22 15:17:24 +00:00
|
|
|
$httpBackend = _$httpBackend_;
|
2018-12-22 10:59:26 +00:00
|
|
|
controller = $componentController('vnClientCreditInsuranceInsuranceIndex', {$stateParams});
|
2018-04-22 15:17:24 +00:00
|
|
|
}));
|
|
|
|
|
2018-07-31 10:00:44 +00:00
|
|
|
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';
|
2018-04-22 15:17:24 +00:00
|
|
|
|
2018-07-31 10:00:44 +00:00
|
|
|
$httpBackend.whenGET(query).respond(res);
|
|
|
|
$httpBackend.expectGET(query);
|
|
|
|
controller.$onInit();
|
|
|
|
$httpBackend.flush();
|
2018-04-22 15:17:24 +00:00
|
|
|
|
2018-07-31 10:00:44 +00:00
|
|
|
expect(controller.isClosed).toBe(true);
|
|
|
|
});
|
2018-04-22 15:17:24 +00:00
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|