Extract admin dashboard from ghabilee-frontend2 into a dedicated Next.js app for backoffice.ghabilee.ir (no SEO indexing / Clarity).
23 lines
923 B
JavaScript
23 lines
923 B
JavaScript
const baseUrl = (process.env.SMOKE_BASE_URL || 'http://127.0.0.1:3000').replace(/\/$/, '')
|
|
|
|
const checks = [
|
|
{ path: '/robots.txt', status: 200 },
|
|
{ path: '/auth', status: 200, contains: '<html' },
|
|
{ path: '/manifest.webmanifest', status: 200 },
|
|
{ path: '/offline.html', status: 200, contains: 'اتصال اینترنت برقرار نیست' },
|
|
{ path: '/health', status: 200 },
|
|
{ path: '/api/v1/events?page=1&pageSize=5', status: 200, contains: '"' },
|
|
]
|
|
|
|
for (const check of checks) {
|
|
const response = await fetch(`${baseUrl}${check.path}`, { redirect: 'manual', signal: AbortSignal.timeout(15_000) })
|
|
const body = await response.text()
|
|
|
|
if (response.status !== check.status || (check.contains && !body.includes(check.contains))) {
|
|
throw new Error(`Smoke check failed: ${check.path} returned ${response.status}`)
|
|
}
|
|
console.log(`✓ ${check.path}`)
|
|
}
|
|
|
|
console.log(`Smoke OK against ${baseUrl}`)
|