2018-08-24 11:16:11 +00:00
|
|
|
import './index.js';
|
|
|
|
|
|
|
|
describe('Claim', () => {
|
|
|
|
describe('Component vnClaimCard', () => {
|
|
|
|
let controller;
|
|
|
|
let $httpBackend;
|
2019-11-10 10:08:44 +00:00
|
|
|
let data = {id: 1, name: 'fooName'};
|
2018-08-24 11:16:11 +00:00
|
|
|
|
2019-10-24 22:53:53 +00:00
|
|
|
beforeEach(ngModule('claim'));
|
2018-08-24 11:16:11 +00:00
|
|
|
|
2019-11-10 10:08:44 +00:00
|
|
|
beforeEach(angular.mock.inject(($componentController, _$httpBackend_, $stateParams) => {
|
2018-08-24 11:16:11 +00:00
|
|
|
$httpBackend = _$httpBackend_;
|
2019-11-10 10:08:44 +00:00
|
|
|
|
|
|
|
let $element = angular.element('<div></div>');
|
|
|
|
controller = $componentController('vnClaimCard', {$element});
|
|
|
|
|
|
|
|
$stateParams.id = data.id;
|
|
|
|
$httpBackend.whenRoute('GET', 'Claims/:id').respond(data);
|
2018-08-24 11:16:11 +00:00
|
|
|
}));
|
|
|
|
|
2019-11-10 10:08:44 +00:00
|
|
|
it('should request data and set it on the controller', () => {
|
|
|
|
controller.reload();
|
|
|
|
$httpBackend.flush();
|
2018-08-24 11:16:11 +00:00
|
|
|
|
2019-11-10 10:08:44 +00:00
|
|
|
expect(controller.claim).toEqual(data);
|
2018-08-24 11:16:11 +00:00
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|