2018-08-24 11:16:11 +00:00
|
|
|
import './index.js';
|
|
|
|
|
|
|
|
describe('Claim', () => {
|
|
|
|
describe('Component vnClaimCard', () => {
|
|
|
|
let $scope;
|
|
|
|
let controller;
|
|
|
|
let $httpBackend;
|
|
|
|
let $state;
|
|
|
|
|
2019-10-24 22:53:53 +00:00
|
|
|
beforeEach(ngModule('claim'));
|
2018-08-24 11:16:11 +00:00
|
|
|
|
2018-12-22 10:59:26 +00:00
|
|
|
beforeEach(angular.mock.inject(($componentController, $rootScope, _$httpBackend_) => {
|
2018-08-24 11:16:11 +00:00
|
|
|
$httpBackend = _$httpBackend_;
|
|
|
|
$scope = $rootScope.$new();
|
|
|
|
$state = {params: {id: 1}};
|
2018-12-22 10:59:26 +00:00
|
|
|
controller = $componentController('vnClaimCard', {$scope, $state});
|
2018-08-24 11:16:11 +00:00
|
|
|
}));
|
|
|
|
|
2018-10-03 06:00:19 +00:00
|
|
|
describe('getCard()', () => {
|
2018-08-24 11:16:11 +00:00
|
|
|
it(`should make a query and save the data in claim`, () => {
|
|
|
|
let json = encodeURIComponent(JSON.stringify(controller.filter));
|
2019-10-24 22:53:53 +00:00
|
|
|
$httpBackend.expectGET(`Claims/${controller.$state.params.id}?filter=${json}`).respond({id: 1});
|
2018-10-03 06:00:19 +00:00
|
|
|
controller.getCard();
|
2018-08-24 11:16:11 +00:00
|
|
|
$httpBackend.flush();
|
|
|
|
|
|
|
|
expect(controller.claim).toEqual({id: 1});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|