File tree Expand file tree Collapse file tree 3 files changed +27
-5
lines changed
atcoder-problems-frontend/src Expand file tree Collapse file tree 3 files changed +27
-5
lines changed Original file line number Diff line number Diff line change 44 ContestCategories ,
55 ContestCategory ,
66} from "../../utils/ContestClassifier" ;
7- import { isLikeContest } from "../../utils/LikeContestUtils" ;
7+ import { isLikeContestCategory } from "../../utils/LikeContestUtils" ;
88
99interface 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
Original file line number Diff line number Diff line change 1- import { getLikeContestCategory } from "./LikeContestUtils" ;
1+ import {
2+ getLikeContestCategory ,
3+ isLikeContestCategory ,
4+ } from "./LikeContestUtils" ;
25import { ContestCategory } from "./ContestClassifier" ;
36
47type 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+ } ) ;
Original file line number Diff line number Diff 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} ;
You can’t perform that action at this time.
0 commit comments