mirror of
https://github.com/coleam00/Archon.git
synced 2026-01-03 13:19:05 -05:00
- Fixing the crawl errors for large crawled files like the NUXT docs.
- Removing the "Completed" steps in reporting. - Cleanup Sockets from PR 250 and 395 with Code Rabbit cleanup suggestions.
This commit is contained in:
@@ -47,10 +47,10 @@ describe('API Configuration', () => {
|
||||
delete (import.meta.env as any).VITE_API_URL;
|
||||
delete (import.meta.env as any).ARCHON_SERVER_PORT;
|
||||
|
||||
const { getApiUrl } = await import('../../src/config/api');
|
||||
|
||||
expect(() => getApiUrl()).toThrow('ARCHON_SERVER_PORT environment variable is required');
|
||||
expect(() => getApiUrl()).toThrow('Default value: 8181');
|
||||
// The error will be thrown during module import because API_FULL_URL calls getApiUrl()
|
||||
await expect(async () => {
|
||||
await import('../../src/config/api');
|
||||
}).rejects.toThrow('ARCHON_SERVER_PORT environment variable is required');
|
||||
});
|
||||
|
||||
it('should use ARCHON_SERVER_PORT when set in development', async () => {
|
||||
@@ -156,73 +156,4 @@ describe('API Configuration', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('MCP Client Service Configuration', () => {
|
||||
let originalEnv: any;
|
||||
|
||||
beforeEach(() => {
|
||||
originalEnv = { ...import.meta.env };
|
||||
vi.resetModules();
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
Object.keys(import.meta.env).forEach(key => {
|
||||
delete (import.meta.env as any)[key];
|
||||
});
|
||||
Object.assign(import.meta.env, originalEnv);
|
||||
});
|
||||
|
||||
it('should throw error when ARCHON_MCP_PORT is not set', async () => {
|
||||
delete (import.meta.env as any).ARCHON_MCP_PORT;
|
||||
|
||||
const { MCPClientService } = await import('../../src/services/mcpClientService');
|
||||
const service = new MCPClientService();
|
||||
|
||||
await expect(service.createArchonClient()).rejects.toThrow('ARCHON_MCP_PORT environment variable is required');
|
||||
await expect(service.createArchonClient()).rejects.toThrow('Default value: 8051');
|
||||
});
|
||||
|
||||
it('should use ARCHON_MCP_PORT when set', async () => {
|
||||
(import.meta.env as any).ARCHON_MCP_PORT = '9051';
|
||||
(import.meta.env as any).ARCHON_SERVER_PORT = '8181';
|
||||
|
||||
// Mock window.location
|
||||
Object.defineProperty(window, 'location', {
|
||||
value: {
|
||||
protocol: 'http:',
|
||||
hostname: 'localhost'
|
||||
},
|
||||
writable: true
|
||||
});
|
||||
|
||||
// Mock the API call
|
||||
global.fetch = vi.fn().mockResolvedValue({
|
||||
ok: true,
|
||||
json: async () => ({
|
||||
id: 'test-id',
|
||||
name: 'Archon',
|
||||
transport_type: 'http',
|
||||
connection_status: 'connected'
|
||||
})
|
||||
});
|
||||
|
||||
const { MCPClientService } = await import('../../src/services/mcpClientService');
|
||||
const service = new MCPClientService();
|
||||
|
||||
try {
|
||||
await service.createArchonClient();
|
||||
|
||||
// Verify the fetch was called with the correct URL
|
||||
expect(global.fetch).toHaveBeenCalledWith(
|
||||
expect.stringContaining('/api/mcp/clients'),
|
||||
expect.objectContaining({
|
||||
method: 'POST',
|
||||
body: expect.stringContaining('9051')
|
||||
})
|
||||
);
|
||||
} catch (error) {
|
||||
// If it fails due to actual API call, that's okay for this test
|
||||
// We're mainly testing that it constructs the URL correctly
|
||||
expect(error).toBeDefined();
|
||||
}
|
||||
});
|
||||
});
|
||||
// MCP Client Service Configuration tests removed - service not currently in use
|
||||
Reference in New Issue
Block a user