Skip to content

Commit ece0dd0

Browse files
committed
🚨 Add tests for arc contest (#747)
1 parent 7f572c6 commit ece0dd0

File tree

1 file changed

+78
-0
lines changed

1 file changed

+78
-0
lines changed

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

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

116+
describe('when contest_id contains arc', () => {
117+
const testCases = [
118+
{ contestId: 'arc001', expected: ContestType.ARC },
119+
{ contestId: 'arc002', expected: ContestType.ARC },
120+
{ contestId: 'arc057', expected: ContestType.ARC },
121+
{ contestId: 'arc058', expected: ContestType.ARC },
122+
{ contestId: 'arc099', expected: ContestType.ARC },
123+
{ contestId: 'arc100', expected: ContestType.ARC },
124+
{ contestId: 'arc101', expected: ContestType.ARC },
125+
{ contestId: 'arc103', expected: ContestType.ARC },
126+
{ contestId: 'arc104', expected: ContestType.ARC },
127+
{ contestId: 'arc105', expected: ContestType.ARC },
128+
{ contestId: 'arc182', expected: ContestType.ARC },
129+
{ contestId: 'arc183', expected: ContestType.ARC },
130+
];
131+
132+
runTests('classifyContest', testCases, ({ contestId, expected }: TestCaseForContestType) => {
133+
expect(classifyContest(contestId)).toEqual(expected);
134+
});
135+
});
136+
116137
describe('when contest_id contains chokudai_S', () => {
117138
const testCases = [
118139
{ contestId: 'chokudai_S001', expected: ContestType.OTHERS },
@@ -241,6 +262,31 @@ describe('Contest', () => {
241262
);
242263
});
243264

265+
describe('when contest_id contains arc', () => {
266+
const testCases = [
267+
{ contestId: 'arc001', expected: ContestType.ARC },
268+
{ contestId: 'arc002', expected: ContestType.ARC },
269+
{ contestId: 'arc057', expected: ContestType.ARC },
270+
{ contestId: 'arc058', expected: ContestType.ARC },
271+
{ contestId: 'arc099', expected: ContestType.ARC },
272+
{ contestId: 'arc100', expected: ContestType.ARC },
273+
{ contestId: 'arc101', expected: ContestType.ARC },
274+
{ contestId: 'arc103', expected: ContestType.ARC },
275+
{ contestId: 'arc104', expected: ContestType.ARC },
276+
{ contestId: 'arc105', expected: ContestType.ARC },
277+
{ contestId: 'arc182', expected: ContestType.ARC },
278+
{ contestId: 'arc183', expected: ContestType.ARC },
279+
];
280+
281+
runTests(
282+
'getContestPriority',
283+
testCases,
284+
({ contestId, expected }: TestCaseForContestType) => {
285+
expect(getContestPriority(contestId)).toEqual(contestTypePriorities.get(expected));
286+
},
287+
);
288+
});
289+
244290
describe('when contest_id contains chokudai_S', () => {
245291
const testCases = [
246292
{ contestId: 'chokudai_S001', expected: ContestType.OTHERS },
@@ -272,6 +318,13 @@ describe('Contest', () => {
272318

273319
expect(getContestUrl(contestId)).toEqual(expected);
274320
});
321+
322+
test('when contest_id is ARC183', () => {
323+
const contestId = 'arc183';
324+
const expected = 'https://atcoder.jp/contests/arc183';
325+
326+
expect(getContestUrl(contestId)).toEqual(expected);
327+
});
275328
});
276329

277330
describe('get contest name label', () => {
@@ -383,6 +436,31 @@ describe('Contest', () => {
383436
expect(getContestNameLabel('math-and-algorithm')).toEqual('アルゴリズムと数学');
384437
});
385438

439+
describe('when contest_id contains arc', () => {
440+
const testCases = [
441+
{ contestId: 'arc001', expected: 'ARC001' },
442+
{ contestId: 'arc002', expected: 'ARC002' },
443+
{ contestId: 'arc057', expected: 'ARC057' },
444+
{ contestId: 'arc058', expected: 'ARC058' },
445+
{ contestId: 'arc099', expected: 'ARC099' },
446+
{ contestId: 'arc100', expected: 'ARC100' },
447+
{ contestId: 'arc101', expected: 'ARC101' },
448+
{ contestId: 'arc103', expected: 'ARC103' },
449+
{ contestId: 'arc104', expected: 'ARC104' },
450+
{ contestId: 'arc105', expected: 'ARC105' },
451+
{ contestId: 'arc182', expected: 'ARC182' },
452+
{ contestId: 'arc183', expected: 'ARC183' },
453+
];
454+
455+
runTests(
456+
'getContestNameLabel',
457+
testCases,
458+
({ contestId, expected }: TestCaseForContestNameLabel) => {
459+
expect(getContestNameLabel(contestId)).toEqual(expected);
460+
},
461+
);
462+
});
463+
386464
describe('when contest_id contains chokudai_S', () => {
387465
const testCases = [
388466
{ contestId: 'chokudai_S001', expected: 'Chokudai SpeedRun 001' },

0 commit comments

Comments
 (0)