UNPKG

devextreme

Version:

HTML5 JavaScript Component Suite for Responsive Web Development

82 lines (81 loc) 2.6 kB
/** * DevExtreme (esm/__internal/scheduler/r1/utils/agenda.santiago.test.js) * Version: 25.2.3 * Build date: Fri Dec 12 2025 * * Copyright (c) 2012 - 2025 Developer Express Inc. ALL RIGHTS RESERVED * Read about DevExtreme licensing here: https://js.devexpress.com/Licensing/ */ import { describe, expect, it } from "@jest/globals"; import timeZoneUtils from "../../m_utils_time_zone"; import { calculateRows } from "./agenda"; const createDate = (year, month, day, hours) => { const dateUTC = timeZoneUtils.createUTCDateWithLocalOffset(new Date(year, month, day, hours)).getTime(); return dateUTC }; describe("calculateRows", (() => { it("should count rows through winter 00:00 DST", (() => { expect(calculateRows([{ groupIndex: 0, startDateUTC: createDate(2016, 8, 6, 10) }, { groupIndex: 0, startDateUTC: createDate(2016, 8, 6, 23) }, { groupIndex: 0, startDateUTC: createDate(2016, 8, 7, 0) }, { groupIndex: 0, startDateUTC: createDate(2016, 8, 7, 2) }, { groupIndex: 0, startDateUTC: createDate(2016, 8, 7, 15) }, { groupIndex: 0, startDateUTC: createDate(2016, 8, 8, 0) }, { groupIndex: 0, startDateUTC: createDate(2016, 8, 8, 16) }, { groupIndex: 0, startDateUTC: createDate(2016, 8, 9, 0) }], 7, new Date(2016, 8, 6), 0)).toEqual([ [2, 3, 2, 1, 0, 0, 0] ]) })); it("should count rows through summer 00:00 DST", (() => { expect(calculateRows([{ groupIndex: 0, startDateUTC: createDate(2016, 3, 3, 10) }, { groupIndex: 0, startDateUTC: createDate(2016, 3, 3, 23) }, { groupIndex: 0, startDateUTC: createDate(2016, 3, 4, 0) }, { groupIndex: 0, startDateUTC: createDate(2016, 3, 4, 2) }, { groupIndex: 0, startDateUTC: createDate(2016, 3, 4, 15) }, { groupIndex: 0, startDateUTC: createDate(2016, 3, 5, 0) }, { groupIndex: 0, startDateUTC: createDate(2016, 3, 5, 16) }, { groupIndex: 0, startDateUTC: createDate(2016, 3, 6, 0) }], 7, new Date(2016, 3, 2), 0)).toEqual([ [0, 2, 3, 2, 1, 0, 0] ]) })) }));