2020-10-05 06:50:07 +00:00
|
|
|
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(`<div></div>`);
|
|
|
|
controller = $componentController('vnConsumptionSearchPanel', {$element});
|
|
|
|
controller.$.filter = {};
|
|
|
|
$httpBackend.expect('GET', 'Campaigns/upcoming').respond(200, {id: 1});
|
|
|
|
}));
|
|
|
|
|
|
|
|
describe('getUpcomingCampaing()', () => {
|
2020-10-05 12:45:39 +00:00
|
|
|
it(`should make an HTTP query and then set the campaign property`, () => {
|
2020-10-05 06:50:07 +00:00
|
|
|
$httpBackend.expect('GET', 'Campaigns/upcoming').respond(200, {id: 2, code: 'allSaints'});
|
|
|
|
controller.getUpcomingCampaing();
|
|
|
|
$httpBackend.flush();
|
|
|
|
|
|
|
|
const filter = controller.$.filter;
|
|
|
|
|
|
|
|
expect(filter.campaign).toEqual(2);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|