salix/modules/route/front/summary/index.spec.js

28 lines
860 B
JavaScript
Raw Normal View History

2019-03-22 10:10:23 +00:00
import './index.js';
describe('Route', () => {
describe('Component summary', () => {
let controller;
let $httpBackend;
beforeEach(ngModule('route'));
beforeEach(angular.mock.inject(($componentController, _$httpBackend_) => {
$httpBackend = _$httpBackend_;
controller = $componentController('vnRouteSummary');
controller.route = {id: 1};
}));
describe('getSummary()', () => {
it('should perform a query to set summary', () => {
$httpBackend.when('GET', `/api/Routes/1/summary`).respond(200, 24);
$httpBackend.expect('GET', `/api/Routes/1/summary`);
controller.getSummary();
$httpBackend.flush();
expect(controller.summary).toEqual(24);
});
});
});
});