Skip to content

Commit 808e90c

Browse files
authored
Merge pull request #1283 from k-yamasaki-zakisan/fix/like-contest-category
メソッド名をisLikeContestからisLikeContestCategoryに変更
2 parents b7a404c + 215e701 commit 808e90c

File tree

3 files changed

+27
-5
lines changed

3 files changed

+27
-5
lines changed

atcoder-problems-frontend/src/pages/TablePage/TableTab.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import {
44
ContestCategories,
55
ContestCategory,
66
} from "../../utils/ContestClassifier";
7-
import { isLikeContest } from "../../utils/LikeContestUtils";
7+
import { isLikeContestCategory } from "../../utils/LikeContestUtils";
88

99
interface Props {
1010
active: ContestCategory;
@@ -17,7 +17,7 @@ export const TableTabButtons: React.FC<Props> = (props) => {
1717

1818
const filteredCategories = useMemo(() => {
1919
return ContestCategories.filter(
20-
(category) => !mergeLikeContest || !isLikeContest(category)
20+
(category) => !mergeLikeContest || !isLikeContestCategory(category)
2121
);
2222
}, [mergeLikeContest]);
2323

atcoder-problems-frontend/src/utils/LikeContestUtils.test.ts

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
import { getLikeContestCategory } from "./LikeContestUtils";
1+
import {
2+
getLikeContestCategory,
3+
isLikeContestCategory,
4+
} from "./LikeContestUtils";
25
import { ContestCategory } from "./ContestClassifier";
36

47
type GetLikeContestTestType = [ContestCategory, ContestCategory | undefined];
@@ -16,6 +19,25 @@ test.each<GetLikeContestTestType>([
1619
["Marathon", undefined],
1720
["Other Sponsored", undefined],
1821
["Other Contests", undefined],
19-
])("Get Like Contest", (contest, result) => {
22+
])("Get Like Contest Category", (contest, result) => {
2023
expect(getLikeContestCategory(contest)).toBe(result);
2124
});
25+
26+
type IsLikeContestCategoryTestType = [ContestCategory, boolean];
27+
test.each<IsLikeContestCategoryTestType>([
28+
["ABC", false],
29+
["ARC", false],
30+
["AGC", false],
31+
["ABC-Like", true],
32+
["ARC-Like", true],
33+
["AGC-Like", true],
34+
["PAST", false],
35+
["JOI", false],
36+
["JAG", false],
37+
["AHC", false],
38+
["Marathon", false],
39+
["Other Sponsored", false],
40+
["Other Contests", false],
41+
])("Is Like Contest Category", (contest, result) => {
42+
expect(isLikeContestCategory(contest)).toBe(result);
43+
});

atcoder-problems-frontend/src/utils/LikeContestUtils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,6 @@ const LikeContestCategories: readonly ContestCategory[] = [
2020
"ARC-Like",
2121
"AGC-Like",
2222
];
23-
export const isLikeContest = (category: ContestCategory) => {
23+
export const isLikeContestCategory = (category: ContestCategory) => {
2424
return LikeContestCategories.includes(category);
2525
};

0 commit comments

Comments
 (0)