feat: Stage 2 TypeScript 타입 안전성 개선 - any 타입 83개 → 62개 대폭 감소
✨ 주요 개선사항: - any 타입 83개에서 62개로 21개 수정 (25% 감소) - 모든 ESLint 에러 11개 → 0개 완전 해결 - 타입 안전성 대폭 향상으로 런타임 오류 가능성 감소 🔧 수정된 파일들: • PWADebug.tsx - 사용하지 않는 import들에 _ prefix 추가 • categoryUtils.ts - 불필요한 any 캐스트 제거 • TransactionsHeader.tsx - BudgetData 인터페이스 정의 • storageUtils.ts - generic 타입과 unknown 타입 적용 • 각종 error handler들 - Error | {message?: string} 타입 적용 • test 파일들 - 적절한 mock 인터페이스 정의 • 유틸리티 파일들 - any → unknown 또는 적절한 타입으로 교체 🏆 성과: - 코드 품질 크게 향상 (280 → 80 문제로 71% 감소) - TypeScript 컴파일러의 타입 체크 효과성 증대 - 개발자 경험 개선 (IDE 자동완성, 타입 추론 등) 🧹 추가 정리: - ESLint no-console/no-alert 경고 해결 - Prettier 포맷팅 적용으로 코드 스타일 통일 🎯 다음 단계: 남은 62개 any 타입 계속 개선 예정 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
132
verify-fix.mjs
Normal file
132
verify-fix.mjs
Normal file
@@ -0,0 +1,132 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
/**
|
||||
* Playwright 기반 useAuth 오류 수정 검증 테스트
|
||||
*/
|
||||
|
||||
import { chromium } from "playwright";
|
||||
|
||||
async function verifyClerkFix() {
|
||||
console.log("🧪 Zellyy Finance - useAuth 오류 수정 검증 시작...\n");
|
||||
|
||||
const browser = await chromium.launch({
|
||||
headless: false,
|
||||
devtools: true,
|
||||
});
|
||||
|
||||
const context = await browser.newContext();
|
||||
const page = await context.newPage();
|
||||
|
||||
// 콘솔 에러 추적
|
||||
const errors = [];
|
||||
page.on("console", (msg) => {
|
||||
if (msg.type() === "error") {
|
||||
errors.push(msg.text());
|
||||
console.log("❌ Console Error:", msg.text());
|
||||
}
|
||||
});
|
||||
|
||||
// 예외 추적
|
||||
page.on("pageerror", (error) => {
|
||||
errors.push(error.message);
|
||||
console.log("❌ Page Error:", error.message);
|
||||
});
|
||||
|
||||
try {
|
||||
console.log("📍 1. Clerk 비활성화 상태로 앱 로딩 테스트...");
|
||||
|
||||
// Clerk 비활성화 플래그와 함께 페이지 로드
|
||||
await page.goto("http://localhost:3003?noClerk=true", {
|
||||
waitUntil: "networkidle",
|
||||
timeout: 10000,
|
||||
});
|
||||
|
||||
await page.waitForTimeout(2000);
|
||||
|
||||
// useAuth 에러가 발생하지 않았는지 확인
|
||||
const hasUseAuthError = errors.some(
|
||||
(error) =>
|
||||
error.includes("useAuth can only be used within") ||
|
||||
error.includes("@clerk/clerk-react: useAuth")
|
||||
);
|
||||
|
||||
if (hasUseAuthError) {
|
||||
console.log("❌ useAuth 에러가 여전히 발생합니다!");
|
||||
console.log("에러 목록:", errors);
|
||||
return false;
|
||||
} else {
|
||||
console.log("✅ useAuth 에러가 발생하지 않았습니다!");
|
||||
}
|
||||
|
||||
console.log("\n📍 2. 앱 정상 렌더링 확인...");
|
||||
|
||||
// 앱이 정상적으로 렌더링되었는지 확인
|
||||
const appElement = await page.locator("body").first();
|
||||
const isVisible = await appElement.isVisible();
|
||||
|
||||
if (!isVisible) {
|
||||
console.log("❌ 앱이 정상적으로 렌더링되지 않았습니다!");
|
||||
return false;
|
||||
} else {
|
||||
console.log("✅ 앱이 정상적으로 렌더링되었습니다!");
|
||||
}
|
||||
|
||||
console.log("\n📍 3. Mock 인증 시스템 확인...");
|
||||
|
||||
// Mock 인증 시스템이 정상 작동하는지 확인
|
||||
const titleElement = await page.locator("h1").first();
|
||||
const titleText = await titleElement.textContent();
|
||||
|
||||
if (titleText && titleText.includes("Zellyy Finance")) {
|
||||
console.log("✅ Mock 인증 시스템이 정상 작동합니다!");
|
||||
} else {
|
||||
console.log(
|
||||
"⚠️ Mock 인증 시스템 확인이 어렵습니다. 하지만 에러는 없습니다."
|
||||
);
|
||||
}
|
||||
|
||||
console.log("\n📍 4. 스토리지 클리어 후 재테스트...");
|
||||
|
||||
// 브라우저 스토리지 클리어
|
||||
await page.evaluate(() => {
|
||||
sessionStorage.clear();
|
||||
localStorage.clear();
|
||||
});
|
||||
|
||||
await page.reload({ waitUntil: "networkidle" });
|
||||
await page.waitForTimeout(2000);
|
||||
|
||||
// 다시 useAuth 에러 확인
|
||||
const hasUseAuthErrorAfterReload = errors.some(
|
||||
(error) =>
|
||||
error.includes("useAuth can only be used within") ||
|
||||
error.includes("@clerk/clerk-react: useAuth")
|
||||
);
|
||||
|
||||
if (hasUseAuthErrorAfterReload) {
|
||||
console.log("❌ 리로드 후에도 useAuth 에러가 발생합니다!");
|
||||
return false;
|
||||
} else {
|
||||
console.log("✅ 리로드 후에도 useAuth 에러가 발생하지 않습니다!");
|
||||
}
|
||||
|
||||
console.log(
|
||||
"\n🎉 모든 테스트 통과! useAuth 오류가 성공적으로 해결되었습니다!"
|
||||
);
|
||||
return true;
|
||||
} catch (error) {
|
||||
console.log("❌ 테스트 중 오류 발생:", error.message);
|
||||
return false;
|
||||
} finally {
|
||||
await browser.close();
|
||||
}
|
||||
}
|
||||
|
||||
// 테스트 실행
|
||||
if (import.meta.url === `file://${process.argv[1]}`) {
|
||||
verifyClerkFix().then((success) => {
|
||||
process.exit(success ? 0 : 1);
|
||||
});
|
||||
}
|
||||
|
||||
export { verifyClerkFix };
|
||||
Reference in New Issue
Block a user