This commit is contained in:
dahyeon committed 2026-05-02 23:47:48 -07:00
1 parent feeb30c6a9
commit 5286e4d1ed
13 files changed
+344 -82

No files matched your search

@@ -74,6 +74,13 @@ describe('parseCommand', () => {
});
});
it('parses match-cancel command with short code', () => {
expect(parseCommand('!내전 취소 AB12')).toEqual({
kind: 'match-cancel',
matchId: 'AB12',
});
});
it('parses account register command', () => {
expect(parseCommand('!내전 계정등록 hello world#KR1')).toEqual({
kind: 'account-register',
@@ -110,12 +117,6 @@ describe('parseCommand', () => {
});
});
it('throws invalid_match_id for non-objectid cancel match', () => {
expect(() => parseCommand('!내전 취소 not-an-id')).toThrow(
/invalid_match_id/,
);
});
it('throws invalid_riot_id when # missing', () => {
expect(() =>
parseCommand('!내전 신청 69b63bc96da18dfdb218ee8c 프리리 미드,탑'),
@@ -94,9 +94,6 @@ function parseCancelArgs(args: string): DakaoCommand {
if (matchId.length === 0) {
throw new CommandParseError('usage');
}
if (!isObjectIdHex(matchId)) {
throw new CommandParseError('invalid_match_id', matchId);
}
return {
kind: 'match-cancel',
@@ -143,7 +140,3 @@ function parseJoinArgs(args: string): DakaoCommand {
positions,
};
}
function isObjectIdHex(value: string): boolean {
return /^[a-f0-9]{24}$/i.test(value);
}