diff --git a/jest.config.js b/jest.config.js index 12733849a5..fb77375940 100644 --- a/jest.config.js +++ b/jest.config.js @@ -9,7 +9,6 @@ const babelTargetList = [ "multi_month_test\\.test\\.tsx", "multiple_selected_dates\\.test\\.tsx", "week_number_test\\.test\\.tsx", - "year_dropdown_test\\.test\\.tsx", ]; const tsTargetList = [ @@ -45,7 +44,7 @@ const tsTargetList = [ "week_picker_test\\.test\\.tsx", "week_test\\.test\\.tsx", "year_dropdown_options_test\\.test\\.tsx", - // "year_dropdown_test\\.test\\.tsx", + "year_dropdown_test\\.test\\.tsx", "year_picker_test\\.test\\.tsx", ]; diff --git a/src/test/test_utils.ts b/src/test/test_utils.ts index 3b30daada7..797c0e76ae 100644 --- a/src/test/test_utils.ts +++ b/src/test/test_utils.ts @@ -57,3 +57,15 @@ export function getKey(key: KeyType, shiftKey = false) { } return { ...event, shiftKey }; } + +export const range = (from: number, to: number): number[] => { + if (to <= from) { + return []; + } + + const list: number[] = []; + for (let i = from; i < to; i++) { + list.push(i); + } + return list; +}; diff --git a/src/test/year_dropdown_test.test.tsx b/src/test/year_dropdown_test.test.tsx index 5509b0106f..b91a9c8411 100644 --- a/src/test/year_dropdown_test.test.tsx +++ b/src/test/year_dropdown_test.test.tsx @@ -1,10 +1,11 @@ import { render, fireEvent } from "@testing-library/react"; -import range from "lodash/range"; import React from "react"; import { newDate } from "../date_utils"; import YearDropdown from "../year_dropdown"; +import { range } from "./test_utils"; + describe("YearDropdown", () => { let yearDropdown: HTMLElement | null = null; let lastOnChangeValue: number | null;