32 lines
1.0 KiB
JavaScript
32 lines
1.0 KiB
JavaScript
|
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()', () => {
|
||
|
it(`should make an HTTP GET query`, () => {
|
||
|
$httpBackend.expect('GET', 'Campaigns/upcoming').respond(200, {id: 2, code: 'allSaints'});
|
||
|
controller.getUpcomingCampaing();
|
||
|
$httpBackend.flush();
|
||
|
|
||
|
const filter = controller.$.filter;
|
||
|
|
||
|
expect(filter.campaign).toEqual(2);
|
||
|
});
|
||
|
});
|
||
|
});
|
||
|
});
|