2018-08-24 11:16:11 +00:00
|
|
|
import './index.js';
|
|
|
|
|
|
|
|
describe('Claim', () => {
|
|
|
|
describe('Component vnClaimCard', () => {
|
|
|
|
let $componentController;
|
|
|
|
let $scope;
|
|
|
|
let controller;
|
|
|
|
let $httpBackend;
|
|
|
|
let $state;
|
|
|
|
|
|
|
|
beforeEach(() => {
|
|
|
|
angular.mock.module('claim');
|
|
|
|
});
|
|
|
|
|
|
|
|
beforeEach(angular.mock.inject((_$componentController_, $rootScope, _$httpBackend_) => {
|
|
|
|
$componentController = _$componentController_;
|
|
|
|
$httpBackend = _$httpBackend_;
|
|
|
|
$httpBackend.when('GET', /\/locale\/\w+\/[a-z]{2}\.json/).respond({});
|
|
|
|
$scope = $rootScope.$new();
|
|
|
|
$state = {params: {id: 1}};
|
|
|
|
controller = $componentController('vnClaimCard', {$scope: $scope, $state: $state});
|
|
|
|
}));
|
|
|
|
|
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));
|
|
|
|
$httpBackend.expectGET(`/claim/api/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});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|