Skip to content

Commit

Permalink
fix src/test/year_dropdown_test.test.tsx
Browse files Browse the repository at this point in the history
  • Loading branch information
yuki0410-dev committed Jun 8, 2024
1 parent 3b3d060 commit 92259bd
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
3 changes: 1 addition & 2 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
Expand Down Expand Up @@ -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",
];

Expand Down
12 changes: 12 additions & 0 deletions src/test/test_utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 [];

Check warning on line 63 in src/test/test_utils.ts

View check run for this annotation

Codecov / codecov/patch

src/test/test_utils.ts#L63

Added line #L63 was not covered by tests
}

const list: number[] = [];
for (let i = from; i < to; i++) {
list.push(i);
}
return list;
};
3 changes: 2 additions & 1 deletion src/test/year_dropdown_test.test.tsx
Original file line number Diff line number Diff line change
@@ -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;
Expand Down

0 comments on commit 92259bd

Please sign in to comment.