import './index.js'; describe('Claim', () => { describe('Component vnClaimCard', () => { let $scope; let controller; let $httpBackend; let $state; beforeEach(angular.mock.module('claim', $translateProvider => { $translateProvider.translations('en', {}); })); beforeEach(angular.mock.inject(($componentController, $rootScope, _$httpBackend_) => { $httpBackend = _$httpBackend_; $scope = $rootScope.$new(); $state = {params: {id: 1}}; controller = $componentController('vnClaimCard', {$scope, $state}); })); describe('getCard()', () => { 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.getCard(); $httpBackend.flush(); expect(controller.claim).toEqual({id: 1}); }); }); }); });