From 03be85d07b0f5b6c50917f0ab5cef1074843809f Mon Sep 17 00:00:00 2001 From: dahyeon Date: Sat, 25 Jul 2026 07:37:32 -0700 Subject: [PATCH] refactor(web): remove redundant history result column --- apps/web/src/pages/HomePage.tsx | 24 +------------------- apps/web/test/home-page-history.test.ts | 29 +++++++++++++++++++++++++ 2 files changed, 30 insertions(+), 23 deletions(-) create mode 100644 apps/web/test/home-page-history.test.ts diff --git a/apps/web/src/pages/HomePage.tsx b/apps/web/src/pages/HomePage.tsx index c21a7a48..ec4bcb3e 100644 --- a/apps/web/src/pages/HomePage.tsx +++ b/apps/web/src/pages/HomePage.tsx @@ -85,7 +85,6 @@ function HistoryTableColGroup() { - ); } @@ -99,7 +98,6 @@ function HistoryTableHeader() { 상태 맵 참가 - 결과 ); @@ -156,14 +154,6 @@ function HistoryRecordsSkeleton({ 10명 - - - 1팀 승리 - - ))} @@ -205,10 +195,6 @@ function HistoryRecordsSkeleton({ 10명 - · - - 1팀 승리 - @@ -682,20 +668,12 @@ export default function HomePage() { {match.participants.length}명 - - - 공식 결과 - - )) ) : ( 아직 내전 기록이 없습니다. diff --git a/apps/web/test/home-page-history.test.ts b/apps/web/test/home-page-history.test.ts new file mode 100644 index 00000000..cfde8ac8 --- /dev/null +++ b/apps/web/test/home-page-history.test.ts @@ -0,0 +1,29 @@ +import assert from "node:assert/strict"; +import { readFile } from "node:fs/promises"; +import test from "node:test"; + +const homePageSource = await readFile( + new URL("../src/pages/HomePage.tsx", import.meta.url), + "utf8", +); + +test("keeps past match history focused on the five summary columns", () => { + const colGroup = sourceForFunction("HistoryTableColGroup"); + const header = sourceForFunction("HistoryTableHeader"); + const skeleton = sourceForFunction("HistoryRecordsSkeleton"); + + assert.equal(colGroup.match(/)/g)?.length, 5); + assert.doesNotMatch(header, />결과<\/th>/); + assert.doesNotMatch(homePageSource, /공식 결과/); + assert.doesNotMatch(skeleton, /1팀 승리/); + assert.match(homePageSource, /colSpan=\{5\}/); +}); + +function sourceForFunction(name: string): string { + const start = homePageSource.indexOf(`function ${name}(`); + assert.notEqual(start, -1, `${name} should exist`); + + const nextFunction = homePageSource.indexOf("\nfunction ", start + 1); + assert.notEqual(nextFunction, -1, `${name} should have a following function`); + return homePageSource.slice(start, nextFunction); +} -- 2.54.0