feat: improve tournament workflows and prune outdated docs
This commit is contained in:
1 parent
da7b502936
commit
38a89b5374
53 files changed
+3308
-3276
No files matched your search
@@ -0,0 +1,50 @@
|
||||
import assert from 'node:assert/strict';
|
||||
import test from 'node:test';
|
||||
import {
|
||||
getHistoryMatchTitle,
|
||||
getHomeMatchEnrollment,
|
||||
getHomeMatchSchedule,
|
||||
} from '../src/pages/home-match-presentation.ts';
|
||||
|
||||
test('uses the Korean schedule and only removes a matching generic title prefix', () => {
|
||||
const schedule = getHomeMatchSchedule('2026-06-25T12:00:00.000Z');
|
||||
assert.equal(schedule?.compact, '6/25 (목) 21:00');
|
||||
assert.equal(
|
||||
getHistoryMatchTitle('6/25 (목) 21시 정기 내전', schedule),
|
||||
'정기 내전',
|
||||
);
|
||||
for (const title of [
|
||||
'6/25 (목) 21시 멸망전',
|
||||
'6/25 (목) 20시 내전',
|
||||
'6/24 (수) 21시 내전',
|
||||
]) {
|
||||
assert.equal(getHistoryMatchTitle(title, schedule), title);
|
||||
}
|
||||
});
|
||||
|
||||
test('promotes application only for an open match with available places', () => {
|
||||
const match = {
|
||||
status: 'recruiting' as const,
|
||||
joined: false,
|
||||
maxParticipants: 4,
|
||||
participants: [],
|
||||
};
|
||||
assert.deepEqual(getHomeMatchEnrollment(match), {
|
||||
canApply: true,
|
||||
capacity: '0/4명',
|
||||
label: '4자리 남음',
|
||||
});
|
||||
assert.deepEqual(getHomeMatchEnrollment({ ...match, maxParticipants: 0 }), {
|
||||
canApply: false,
|
||||
capacity: '0명',
|
||||
label: '모집 마감',
|
||||
});
|
||||
assert.equal(
|
||||
getHomeMatchEnrollment({ ...match, status: 'team-built' }).canApply,
|
||||
false,
|
||||
);
|
||||
assert.equal(
|
||||
getHomeMatchEnrollment({ ...match, joined: true }).label,
|
||||
'참가 완료',
|
||||
);
|
||||
});
|
||||
@@ -7,16 +7,19 @@ const homePageSource = await readFile(
|
||||
"utf8",
|
||||
);
|
||||
|
||||
test("keeps past match history focused on the five summary columns", () => {
|
||||
const colGroup = sourceForFunction("HistoryTableColGroup");
|
||||
const header = sourceForFunction("HistoryTableHeader");
|
||||
test("shares the four history columns between records and the loading state", () => {
|
||||
const columns = sourceForFunction("HistoryTableColumns");
|
||||
const skeleton = sourceForFunction("HistoryRecordsSkeleton");
|
||||
const records = sourceForFunction("HistoryRecords");
|
||||
|
||||
assert.equal(colGroup.match(/<col(?:\s|\/|>)/g)?.length, 5);
|
||||
assert.doesNotMatch(header, />결과<\/th>/);
|
||||
assert.doesNotMatch(homePageSource, /공식 결과/);
|
||||
assert.doesNotMatch(skeleton, /1팀 승리/);
|
||||
assert.match(homePageSource, /colSpan=\{5\}/);
|
||||
assert.equal(columns.match(/<col(?:\s|\/|>)/g)?.length, 4);
|
||||
assert.deepEqual(
|
||||
Array.from(columns.matchAll(/<th\b[^>]*>\s*([^<]+?)\s*<\/th>/g), (match) => match[1]),
|
||||
["일정", "내전", "결과", "참가"],
|
||||
);
|
||||
assert.match(skeleton, /<HistoryTableColumns\s*\/>/);
|
||||
assert.match(records, /<HistoryTableColumns\s*\/>/);
|
||||
assert.doesNotMatch(skeleton, /<HistoryResult\b/);
|
||||
});
|
||||
|
||||
function sourceForFunction(name: string): string {
|
||||
|
||||
Reference in new issue
Block a user