mirror of
https://github.com/samanhappy/mcphub.git
synced 2025-12-23 18:29:21 -05:00
Address code review comments: remove redundant cleanup and clarify test intent
Co-authored-by: samanhappy <2755122+samanhappy@users.noreply.github.com>
This commit is contained in:
@@ -77,9 +77,6 @@ describe('AppServer with BASE_PATH configuration', () => {
|
|||||||
// Test that /mcphub/public-config endpoint exists
|
// Test that /mcphub/public-config endpoint exists
|
||||||
const publicConfigResponse = await request(app).get('/mcphub/public-config');
|
const publicConfigResponse = await request(app).get('/mcphub/public-config');
|
||||||
expect(publicConfigResponse.status).not.toBe(404);
|
expect(publicConfigResponse.status).not.toBe(404);
|
||||||
|
|
||||||
// Clean up
|
|
||||||
delete process.env.BASE_PATH;
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should serve auth routes without BASE_PATH (default)', async () => {
|
it('should serve auth routes without BASE_PATH (default)', async () => {
|
||||||
@@ -109,7 +106,7 @@ describe('AppServer with BASE_PATH configuration', () => {
|
|||||||
expect(publicConfigResponse.status).not.toBe(404);
|
expect(publicConfigResponse.status).not.toBe(404);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should correctly mount API routes with BASE_PATH', async () => {
|
it('should serve global endpoints without BASE_PATH prefix', async () => {
|
||||||
process.env.BASE_PATH = '/test-base/';
|
process.env.BASE_PATH = '/test-base/';
|
||||||
|
|
||||||
jest.resetModules();
|
jest.resetModules();
|
||||||
@@ -121,11 +118,13 @@ describe('AppServer with BASE_PATH configuration', () => {
|
|||||||
|
|
||||||
const app = appServer.getApp();
|
const app = appServer.getApp();
|
||||||
|
|
||||||
// Test that API routes are accessible with base path
|
// Test that /health endpoint is accessible globally (no BASE_PATH prefix)
|
||||||
const apiHealthResponse = await request(app).get('/health');
|
// The /health endpoint is intentionally mounted without BASE_PATH
|
||||||
expect(apiHealthResponse.status).not.toBe(404);
|
const healthResponse = await request(app).get('/health');
|
||||||
|
expect(healthResponse.status).not.toBe(404);
|
||||||
|
|
||||||
// Clean up
|
// Also verify that BASE_PATH prefixed routes exist
|
||||||
delete process.env.BASE_PATH;
|
const configResponse = await request(app).get('/test-base/config');
|
||||||
|
expect(configResponse.status).not.toBe(404);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user