salix/modules/travel/front/main/index.spec.js

25 lines
722 B
JavaScript
Raw Normal View History

2020-03-16 17:08:44 +00:00
import './index.js';
describe('Travel Component vnTravel', () => {
let controller;
beforeEach(ngModule('travel'));
beforeEach(angular.mock.inject($componentController => {
let $element = angular.element(`<div></div>`);
controller = $componentController('vnTravel', {$element});
}));
describe('fetchParams()', () => {
it('should return a range of dates with passed scope days', () => {
let params = controller.fetchParams({scopeDays: 2});
let from = params.shippedFrom.getTime();
let to = params.shippedTo.getTime() + 1;
let msInDay = 86400 * 1000;
expect(to - from).toEqual(3 * msInDay);
});
});
});