website refactor
This commit is contained in:
@@ -306,4 +306,34 @@ describe('Website DI Container Integration', () => {
|
||||
expect(typeof config2).toBe('function');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('SSR Boot Safety', () => {
|
||||
it('resolves all tokens required for SSR entry rendering', () => {
|
||||
process.env.API_BASE_URL = 'http://localhost:3001';
|
||||
const container = createContainer();
|
||||
|
||||
// Tokens typically used in SSR (middleware, layouts, initial page loads)
|
||||
const ssrTokens = [
|
||||
LOGGER_TOKEN,
|
||||
CONFIG_TOKEN,
|
||||
SESSION_SERVICE_TOKEN,
|
||||
AUTH_SERVICE_TOKEN,
|
||||
LEAGUE_SERVICE_TOKEN,
|
||||
DRIVER_SERVICE_TOKEN,
|
||||
DASHBOARD_SERVICE_TOKEN,
|
||||
// API clients are often resolved by services
|
||||
AUTH_API_CLIENT_TOKEN,
|
||||
LEAGUE_API_CLIENT_TOKEN,
|
||||
];
|
||||
|
||||
for (const token of ssrTokens) {
|
||||
try {
|
||||
const service = container.get(token);
|
||||
expect(service, `Failed to resolve ${token.toString()}`).toBeDefined();
|
||||
} catch (error) {
|
||||
throw new Error(`SSR Boot Safety Failure: Could not resolve ${token.toString()}. Error: ${error.message}`);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user