Skip to content

Commit 41bba20

Browse files
committed
🚨 Add and update tests for university contest label (#1526)
1 parent 9d39c53 commit 41bba20

File tree

1 file changed

+11
-14
lines changed

1 file changed

+11
-14
lines changed

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

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -548,22 +548,19 @@ describe('Contest', () => {
548548
});
549549

550550
describe('get AtCoder university contest label', () => {
551-
describe('expected to be thrown an error if an invalid format is given', () => {
552-
test('when utpc is given', () => {
553-
expect(() => getAtCoderUniversityContestLabel('utpc24')).toThrow(
554-
'Invalid university contest ID format: utpc24',
555-
);
556-
});
557-
558-
test('when ttpc is given', () => {
559-
expect(() => getAtCoderUniversityContestLabel('ttpc')).toThrow(
560-
'Invalid university contest ID format: ttpc',
561-
);
551+
describe('expected to return correct label for valid format', () => {
552+
test.each([
553+
['utpc2019', 'UTPC 2019'],
554+
['ttpc2022', 'TTPC 2022'],
555+
])('when %s is given', (input, expected) => {
556+
expect(getAtCoderUniversityContestLabel(input)).toBe(expected);
562557
});
558+
});
563559

564-
test('when tupc is given', () => {
565-
expect(() => getAtCoderUniversityContestLabel('tupc')).toThrow(
566-
'Invalid university contest ID format: tupc',
560+
describe('expected to be thrown an error if an invalid format is given', () => {
561+
test.each(['utpc24', 'ttpc', 'tupc'])('when %s is given', (input) => {
562+
expect(() => getAtCoderUniversityContestLabel(input)).toThrow(
563+
`Invalid university contest ID format: ${input}`,
567564
);
568565
});
569566
});

0 commit comments

Comments
 (0)