32 lines
1.1 KiB
JavaScript
32 lines
1.1 KiB
JavaScript
import { render } from '../dist-ssr/entry-server.js';
|
|
import { DEFAULT_PATH } from '../src/config.js';
|
|
|
|
const testUrls = [
|
|
'/',
|
|
DEFAULT_PATH,
|
|
'/regions',
|
|
'/admin',
|
|
'/seoul/gangnam-gu/yeoksam-dong/high/korean',
|
|
'/busan/haeundae-gu/u-dong/middle/english',
|
|
'/invalid/random/not-exist-path'
|
|
];
|
|
|
|
console.log('=== 라우터 및 SSR 검사 시작 ===\n');
|
|
|
|
for (const url of testUrls) {
|
|
try {
|
|
const result = await render(url);
|
|
const hasHtml = result.html && result.html.length > 50;
|
|
const hasHead = typeof result.head === 'string';
|
|
const h1Count = (result.html.match(/<h1[\s>]/g) || []).length;
|
|
console.log(`[URL] ${url}`);
|
|
console.log(` - 매칭 라우트명: ${result.routeName}`);
|
|
console.log(` - SSR HTML 길이: ${result.html.length} chars (정상 렌더링: ${hasHtml})`);
|
|
console.log(` - SSR Head 유무: ${hasHead ? 'YES (' + result.head.length + ' chars)' : 'NO'}`);
|
|
console.log(` - h1 태그 수: ${h1Count}`);
|
|
console.log('--------------------------------------------------');
|
|
} catch (err) {
|
|
console.error(`[FAIL] ${url} 렌더링 에러:`, err);
|
|
}
|
|
}
|