37 lines
1.2 KiB
JavaScript
37 lines
1.2 KiB
JavaScript
|
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});
|
||
|
}));
|
||
|
|
||
|
describe('getClaim()', () => {
|
||
|
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});
|
||
|
controller.getClaim();
|
||
|
$httpBackend.flush();
|
||
|
|
||
|
expect(controller.claim).toEqual({id: 1});
|
||
|
});
|
||
|
});
|
||
|
});
|
||
|
});
|
||
|
|