25 lines
722 B
JavaScript
25 lines
722 B
JavaScript
|
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);
|
||
|
});
|
||
|
});
|
||
|
});
|