/**
 * DevExtreme (cjs/ui/scheduler/workspaces/view_model/__tests__/utils.test.js)
 * Version: 22.2.7 (build 23219-0309)
 * Build date: Mon Aug 07 2023
 *
 * Copyright (c) 2012 - 2023 Developer Express Inc. ALL RIGHTS RESERVED
 * Read about DevExtreme licensing here: https://js.devexpress.com/Licensing/
 */
"use strict";
var _utils = require("../utils");
var _jestEach = _interopRequireDefault(require("jest-each"));
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8;

function _interopRequireDefault(obj) {
    return obj && obj.__esModule ? obj : {
        default: obj
    }
}

function _taggedTemplateLiteral(strings, raw) {
    if (!raw) {
        raw = strings.slice(0)
    }
    return Object.freeze(Object.defineProperties(strings, {
        raw: {
            value: Object.freeze(raw)
        }
    }))
}
describe("alignToFirstDayOfWeek", (function() {
    (0, _jestEach.default)(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n        date                      | firstDayOfWeek\n        ", " | ", "\n        ", " | ", "\n    "])), new Date("2023-06-26"), 1, new Date("2023-06-25"), 0).it("should return the same value if date is first day of week", (function(_ref) {
        var date = _ref.date,
            firstDayOfWeek = _ref.firstDayOfWeek;
        var resultDate = (0, _utils.alignToFirstDayOfWeek)(date, firstDayOfWeek);
        expect(resultDate).toEqual(date)
    }));
    (0, _jestEach.default)(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n        date                      | rightDate                 | firstDayOfWeek \n        ", " | ", " | ", "\n        ", " | ", " | ", "\n        ", " | ", " | ", "\n\n        ", " | ", " | ", "\n\n        ", " | ", " | ", "\n    "])), new Date("2023-06-29"), new Date("2023-06-26"), 1, new Date("2023-06-27"), new Date("2023-06-26"), 1, new Date("2023-06-30"), new Date("2023-06-26"), 1, new Date("2023-06-25"), new Date("2023-06-19"), 1, new Date("2023-06-26"), new Date("2023-06-25"), 0).it("should return first day of current week", (function(_ref2) {
        var date = _ref2.date,
            rightDate = _ref2.rightDate,
            firstDayOfWeek = _ref2.firstDayOfWeek;
        var resultDate = (0, _utils.alignToFirstDayOfWeek)(date, firstDayOfWeek);
        expect(resultDate).toEqual(rightDate)
    }))
}));
describe("alignToLastDayOfWeek", (function() {
    (0, _jestEach.default)(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n        date                      | firstDayOfWeek\n        ", " | ", "\n        ", " | ", "\n    "])), new Date("2023-06-25"), 1, new Date("2023-06-24"), 0).it("should return the same value if date is last day of week", (function(_ref3) {
        var date = _ref3.date,
            firstDayOfWeek = _ref3.firstDayOfWeek;
        var resultDate = (0, _utils.alignToLastDayOfWeek)(date, firstDayOfWeek);
        expect(resultDate).toEqual(date)
    }));
    (0, _jestEach.default)(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n        date                      | rightDate                 | firstDayOfWeek \n        ", " | ", " | ", "\n        ", " | ", " | ", "\n        ", " | ", " | ", "\n\n        ", " | ", " | ", "\n    "])), new Date("2023-06-12"), new Date("2023-06-18"), 1, new Date("2023-06-14"), new Date("2023-06-18"), 1, new Date("2023-06-16"), new Date("2023-06-18"), 1, new Date("2023-06-21"), new Date("2023-06-25"), 1).it("should return last day of current week", (function(_ref4) {
        var date = _ref4.date,
            rightDate = _ref4.rightDate,
            firstDayOfWeek = _ref4.firstDayOfWeek;
        var resultDate = (0, _utils.alignToLastDayOfWeek)(date, firstDayOfWeek);
        expect(resultDate).toEqual(rightDate)
    }))
}));
describe("calculateDaysBetweenDates", (function() {
    (0, _jestEach.default)(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n        fromDate                  | toDate                     | res\n        ", " | ", "  | ", "\n        ", " | ", "  | ", "\n        ", " | ", "  | ", "\n    "])), new Date("2023-06-28"), new Date("2023-06-28"), 1, new Date("2023-06-28"), new Date("2023-06-29"), 2, new Date("2023-06-28"), new Date("2023-07-04"), 7).it("should return right count of days between dates", (function(_ref5) {
        var fromDate = _ref5.fromDate,
            toDate = _ref5.toDate,
            res = _ref5.res;
        expect((0, _utils.calculateDaysBetweenDates)(fromDate, toDate)).toBe(res)
    }));
    (0, _jestEach.default)(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n        fromDate                  | toDate                     | res\n        ", " | ", "  | ", "\n        ", " | ", "  | ", "\n    "])), new Date("2023-06-28T23:59:00"), new Date("2023-06-29T00:01:00"), 2, new Date("2023-06-28T00:01:00"), new Date("2023-06-28T23:59:00"), 1).it("should return right count of days between dates when they have non-zero time", (function(_ref6) {
        var fromDate = _ref6.fromDate,
            toDate = _ref6.toDate,
            res = _ref6.res;
        expect((0, _utils.calculateDaysBetweenDates)(fromDate, toDate)).toBe(res)
    }))
}));
describe("calculateAlignedWeeksBetweenDates", (function() {
    (0, _jestEach.default)(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n        fromDate                  | toDate                     | res\n        ", " | ", "  | ", "\n        ", " | ", "  | ", "\n    "])), new Date("2023-10-01"), new Date("2023-10-31"), 6, new Date("2023-06-01"), new Date("2023-07-31"), 10).it("should return right count of days between dates", (function(_ref7) {
        var fromDate = _ref7.fromDate,
            toDate = _ref7.toDate,
            res = _ref7.res;
        expect((0, _utils.calculateAlignedWeeksBetweenDates)(fromDate, toDate, 1)).toBe(res)
    }));
    (0, _jestEach.default)(_templateObject8 || (_templateObject8 = _taggedTemplateLiteral(["\n        fromDate                  | toDate                     | res\n        ", " | ", "  | ", "\n        ", " | ", "  | ", "\n        ", " | ", "  | ", "\n    "])), new Date("2023-06-04"), new Date("2023-06-12"), 6, new Date("2023-06-05"), new Date("2023-06-12"), 6, new Date("2023-06-05"), new Date("2023-06-11"), 6).it("should return at least 6 weeks in order to not make breaking change", (function(_ref8) {
        var fromDate = _ref8.fromDate,
            toDate = _ref8.toDate,
            res = _ref8.res;
        expect((0, _utils.calculateAlignedWeeksBetweenDates)(fromDate, toDate, 1)).toBe(res)
    }))
}));
