salix/modules/claim/front/card/index.spec.js

32 lines
1.0 KiB
JavaScript
Raw Normal View History

2018-08-24 11:16:11 +00:00
import './index.js';
describe('Claim', () => {
describe('Component vnClaimCard', () => {
let $scope;
let controller;
let $httpBackend;
let $state;
beforeEach(ngModule('claim'));
2018-08-24 11:16:11 +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}};
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));
$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});
});
});
});
});