Skip to content

Commit f85dcd5

Browse files
committed
🚨 Add tests for others contest (#1165)
1 parent be3b355 commit f85dcd5

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed

src/test/lib/utils/contest.test.ts

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,17 @@ describe('Contest', () => {
113113
expect(classifyContest('math-and-algorithm')).toEqual(ContestType.MATH_AND_ALGORITHM);
114114
});
115115

116+
describe('when contest_id contains chokudai_S', () => {
117+
const testCases = [
118+
{ contestId: 'chokudai_S001', expected: ContestType.OTHERS },
119+
{ contestId: 'chokudai_S002', expected: ContestType.OTHERS },
120+
];
121+
122+
runTests('classifyContest', testCases, ({ contestId, expected }: TestCaseForContestType) => {
123+
expect(classifyContest(contestId)).toEqual(expected);
124+
});
125+
});
126+
116127
function runTests(
117128
testName: string,
118129
testCases: TestCasesForContestType,
@@ -230,6 +241,21 @@ describe('Contest', () => {
230241
);
231242
});
232243

244+
describe('when contest_id contains chokudai_S', () => {
245+
const testCases = [
246+
{ contestId: 'chokudai_S001', expected: ContestType.OTHERS },
247+
{ contestId: 'chokudai_S002', expected: ContestType.OTHERS },
248+
];
249+
250+
runTests(
251+
'getContestPriority',
252+
testCases,
253+
({ contestId, expected }: TestCaseForContestType) => {
254+
expect(getContestPriority(contestId)).toEqual(contestTypePriorities.get(expected));
255+
},
256+
);
257+
});
258+
233259
function runTests(
234260
testName: string,
235261
testCases: TestCasesForContestType,
@@ -357,6 +383,21 @@ describe('Contest', () => {
357383
expect(getContestNameLabel('math-and-algorithm')).toEqual('アルゴリズムと数学');
358384
});
359385

386+
describe('when contest_id contains chokudai_S', () => {
387+
const testCases = [
388+
{ contestId: 'chokudai_S001', expected: 'Chokudai SpeedRun 001' },
389+
{ contestId: 'chokudai_S002', expected: 'Chokudai SpeedRun 002' },
390+
];
391+
392+
runTests(
393+
'getContestNameLabel',
394+
testCases,
395+
({ contestId, expected }: TestCaseForContestNameLabel) => {
396+
expect(getContestNameLabel(contestId)).toEqual(expected);
397+
},
398+
);
399+
});
400+
360401
function runTests(
361402
testName: string,
362403
testCases: TestCasesForContestNameLabel,

0 commit comments

Comments
 (0)