import './index.js'; describe('Client', () => { describe('Component vnConsumptionSearchPanel', () => { let $httpBackend; let $element; let controller; beforeEach(ngModule('client')); beforeEach(inject(($componentController, _$httpBackend_) => { $httpBackend = _$httpBackend_; $element = angular.element(`
`); controller = $componentController('vnConsumptionSearchPanel', {$element}); controller.$.filter = {}; $httpBackend.expect('GET', 'Campaigns/upcoming').respond(200, {id: 1}); })); describe('getUpcomingCampaing()', () => { it(`should make an HTTP query and then set the campaign property`, () => { $httpBackend.expect('GET', 'Campaigns/upcoming').respond(200, {id: 2, code: 'allSaints'}); controller.getUpcomingCampaing(); $httpBackend.flush(); const filter = controller.$.filter; expect(filter.campaign).toEqual(2); }); }); }); });