fix issues

This commit is contained in:
2026-01-07 16:20:19 +01:00
parent 3b3971e653
commit 1b63fa646c
17 changed files with 758 additions and 187 deletions

View File

@@ -205,16 +205,88 @@ test.describe('Website Pages - TypeORM Integration', () => {
!msg.includes('connection refused') &&
!msg.includes('failed to load resource') &&
!msg.includes('network error') &&
!msg.includes('cors') &&
!msg.includes('api');
!msg.includes('cors');
});
// Check for critical runtime errors that should never occur
const criticalErrors = errors.filter(error => {
const msg = error.message.toLowerCase();
return msg.includes('no queryclient set') ||
msg.includes('use queryclientprovider') ||
msg.includes('console.groupcollapsed is not a function') ||
msg.includes('console.groupend is not a function');
});
if (unexpectedErrors.length > 0) {
console.log(`[TEST DEBUG] Unexpected errors on ${path}:`, unexpectedErrors);
}
// Allow some errors in test environment due to network/API issues
expect(unexpectedErrors.length).toBeLessThanOrEqual(0);
if (criticalErrors.length > 0) {
console.log(`[TEST DEBUG] CRITICAL errors on ${path}:`, criticalErrors);
throw new Error(`Critical runtime errors on ${path}: ${JSON.stringify(criticalErrors)}`);
}
// Fail on any unexpected errors including DI binding failures
expect(unexpectedErrors.length).toBe(0);
}
});
test('detect DI binding failures and missing metadata on boot', async ({ page }) => {
// Test critical routes that would trigger DI container creation
const criticalRoutes = [
'/leagues',
'/dashboard',
'/teams',
'/drivers',
'/races',
'/leaderboards'
];
for (const path of criticalRoutes) {
const capture = new ConsoleErrorCapture(page);
const response = await page.goto(`${WEBSITE_BASE_URL}${path}`);
await page.waitForTimeout(500);
// Check for 500 errors
const status = response?.status();
if (status === 500) {
console.log(`[TEST DEBUG] 500 error on ${path}`);
const bodyText = await page.textContent('body');
console.log(`[TEST DEBUG] Body content: ${bodyText?.substring(0, 500)}`);
}
// Check for DI-related errors in console
const errors = capture.getErrors();
const diErrors = errors.filter(error => {
const msg = error.message.toLowerCase();
return msg.includes('binding') ||
msg.includes('metadata') ||
msg.includes('inversify') ||
msg.includes('symbol') ||
msg.includes('no binding') ||
msg.includes('not bound');
});
// Check for React Query provider errors
const queryClientErrors = errors.filter(error => {
const msg = error.message.toLowerCase();
return msg.includes('no queryclient set') ||
msg.includes('use queryclientprovider');
});
if (diErrors.length > 0) {
console.log(`[TEST DEBUG] DI errors on ${path}:`, diErrors);
}
if (queryClientErrors.length > 0) {
console.log(`[TEST DEBUG] QueryClient errors on ${path}:`, queryClientErrors);
throw new Error(`QueryClient provider missing on ${path}: ${JSON.stringify(queryClientErrors)}`);
}
// Fail on DI errors or 500 status
expect(diErrors.length).toBe(0);
expect(status).not.toBe(500);
}
});