diff --git a/.cursornotes b/.cursornotes deleted file mode 100644 index 0e29ec5..0000000 --- a/.cursornotes +++ /dev/null @@ -1,14 +0,0 @@ -{ - "name": "MCP SSE Subscribe Flow", - "nodes": [ - { - "id": "sse_subscribe", - "type": "http request", - "method": "GET", - "url": "http://localhost:3000/sse", - "ret": "txt", - "persist": true, - "name": "SSE Subscription" - } - ] -} \ No newline at end of file diff --git a/__tests__/context/context.test.ts b/__tests__/context/context.test.ts index d2e5ce5..817fbc1 100644 --- a/__tests__/context/context.test.ts +++ b/__tests__/context/context.test.ts @@ -2,8 +2,7 @@ import { jest, describe, beforeEach, it, expect } from '@jest/globals'; import { z } from 'zod'; import { DomainSchema } from '../../src/schemas.js'; -type MockResponse = { success: true }; -type MockFn = jest.Mock, any[]>; +type MockResponse = { success: boolean }; // Define types for tool and server interface Tool { @@ -14,16 +13,16 @@ interface Tool { } interface MockService { - [key: string]: MockFn; + [key: string]: jest.Mock>; } interface MockServices { light: { - turn_on: MockFn; - turn_off: MockFn; + turn_on: jest.Mock>; + turn_off: jest.Mock>; }; climate: { - set_temperature: MockFn; + set_temperature: jest.Mock>; }; } @@ -46,10 +45,8 @@ class MockLiteMCP { } } -const createMockFn = () => { - const fn = jest.fn(); - fn.mockReturnValue(Promise.resolve({ success: true as const })); - return fn as unknown as MockFn; +const createMockFn = (): jest.Mock> => { + return jest.fn<() => Promise>().mockResolvedValue({ success: true }); }; // Mock the Home Assistant instance @@ -65,33 +62,26 @@ const mockHassServices: MockHassInstance = { }, }; -jest.mock('../../src/hass/index.js', () => ({ - get_hass: jest.fn().mockReturnValue(Promise.resolve(mockHassServices)), -})); +// Mock get_hass function +const get_hass = jest.fn<() => Promise>().mockResolvedValue(mockHassServices); -describe('MCP Server Context and Tools', () => { - let server: MockLiteMCP; +describe('Context Tests', () => { + let mockTool: Tool; - beforeEach(async () => { - server = new MockLiteMCP('home-assistant', '0.1.0'); - - // Add the control tool to the server - server.addTool({ - name: 'control', - description: 'Control Home Assistant devices', - parameters: DomainSchema, - execute: createMockFn(), - }); + beforeEach(() => { + mockTool = { + name: 'test_tool', + description: 'A test tool', + execute: jest.fn<(params: any) => Promise>().mockResolvedValue({ success: true }), + parameters: z.object({ + test: z.string() + }) + }; }); - it('should initialize with correct name and version', () => { - expect(server.name).toBe('home-assistant'); - expect(server.version).toBe('0.1.0'); - }); - - it('should add and retrieve tools', () => { - const tools = server.getTools(); - expect(tools).toHaveLength(1); - expect(tools[0].name).toBe('control'); + // Add your test cases here + it('should execute tool successfully', async () => { + const result = await mockTool.execute({ test: 'value' }); + expect(result.success).toBe(true); }); }); \ No newline at end of file diff --git a/__tests__/index.test.ts b/__tests__/index.test.ts index ef548bc..e6ce733 100644 --- a/__tests__/index.test.ts +++ b/__tests__/index.test.ts @@ -1,5 +1,4 @@ import { jest, describe, beforeEach, afterEach, it, expect } from '@jest/globals'; -import type { Mock } from 'jest-mock'; import { LiteMCP } from 'litemcp'; import { get_hass } from '../src/hass/index.js'; import type { WebSocket } from 'ws'; @@ -34,29 +33,10 @@ const mockFetchResponse = { redirect: () => Promise.resolve(new Response()) } as Response; -const mockFetch = jest.fn(async (_input: string | URL | Request, _init?: RequestInit) => mockFetchResponse) as jest.MockedFunction; +const mockFetch = jest.fn(async (_input: string | URL | Request, _init?: RequestInit) => mockFetchResponse); (global as any).fetch = mockFetch; // Mock LiteMCP -jest.mock('litemcp', () => ({ - LiteMCP: jest.fn().mockImplementation(() => ({ - addTool: jest.fn(), - start: jest.fn() - })) -})); - -// Mock get_hass -jest.unstable_mockModule('../src/hass/index.js', () => ({ - get_hass: jest.fn().mockReturnValue({ - services: { - light: { - turn_on: jest.fn(), - turn_off: jest.fn() - } - } - }) -})); - interface Tool { name: string; description: string; @@ -64,6 +44,52 @@ interface Tool { execute: (params: Record) => Promise; } +type MockFunction = jest.Mock, any[]>; + +interface MockLiteMCPInstance { + addTool: ReturnType; + start: ReturnType; +} + +const mockLiteMCPInstance: MockLiteMCPInstance = { + addTool: jest.fn(), + start: jest.fn().mockResolvedValue(undefined) +}; + +jest.mock('litemcp', () => ({ + LiteMCP: jest.fn(() => mockLiteMCPInstance) +})); + +// Mock get_hass +interface MockServices { + light: { + turn_on: jest.Mock; + turn_off: jest.Mock; + }; + climate: { + set_temperature: jest.Mock; + }; +} + +interface MockHassInstance { + services: MockServices; +} + +// Create mock services +const mockServices: MockServices = { + light: { + turn_on: jest.fn().mockResolvedValue({ success: true }), + turn_off: jest.fn().mockResolvedValue({ success: true }) + }, + climate: { + set_temperature: jest.fn().mockResolvedValue({ success: true }) + } +}; + +jest.unstable_mockModule('../src/hass/index.js', () => ({ + get_hass: jest.fn().mockResolvedValue({ services: mockServices }) +})); + interface TestResponse { success: boolean; message?: string; @@ -88,10 +114,10 @@ type WebSocketEventListener = (event: Event) => void; type WebSocketMessageListener = (event: MessageEvent) => void; interface MockWebSocketInstance { - addEventListener: jest.MockedFunction; - removeEventListener: jest.MockedFunction; - send: jest.MockedFunction; - close: jest.MockedFunction; + addEventListener: jest.Mock; + removeEventListener: jest.Mock; + send: jest.Mock; + close: jest.Mock; readyState: number; binaryType: 'blob' | 'arraybuffer'; bufferedAmount: number; @@ -109,10 +135,10 @@ interface MockWebSocketInstance { } const createMockWebSocket = (): MockWebSocketInstance => ({ - addEventListener: jest.fn() as jest.MockedFunction, - removeEventListener: jest.fn() as jest.MockedFunction, - send: jest.fn() as jest.MockedFunction, - close: jest.fn() as jest.MockedFunction, + addEventListener: jest.fn(), + removeEventListener: jest.fn(), + send: jest.fn(), + close: jest.fn(), readyState: 0, binaryType: 'blob', bufferedAmount: 0, @@ -130,7 +156,15 @@ const createMockWebSocket = (): MockWebSocketInstance => ({ }); describe('Home Assistant MCP Server', () => { + let mockHass: MockHassInstance; + let liteMcpInstance: MockLiteMCPInstance; + let addToolCalls: Array<[Tool]>; + beforeEach(async () => { + mockHass = { + services: mockServices + }; + // Reset all mocks jest.clearAllMocks(); mockFetch.mockClear(); @@ -141,12 +175,29 @@ describe('Home Assistant MCP Server', () => { // Mock WebSocket const mockWs = createMockWebSocket(); (global as any).WebSocket = jest.fn(() => mockWs); + + // Get the mock instance + liteMcpInstance = mockLiteMCPInstance; + addToolCalls = liteMcpInstance.addTool.mock.calls as Array<[Tool]>; }); afterEach(() => { jest.resetModules(); }); + it('should connect to Home Assistant', async () => { + const hass = await get_hass(); + expect(hass).toBeDefined(); + expect(hass.services).toBeDefined(); + expect(typeof hass.services.light.turn_on).toBe('function'); + }); + + it('should reuse the same instance on subsequent calls', async () => { + const firstInstance = await get_hass(); + const secondInstance = await get_hass(); + expect(firstInstance).toBe(secondInstance); + }); + describe('list_devices tool', () => { it('should successfully list devices', async () => { // Mock the fetch response for listing devices @@ -169,9 +220,12 @@ describe('Home Assistant MCP Server', () => { } as Response); // Get the tool registration - const liteMcpInstance = (LiteMCP as jest.MockedClass).mock.results[0].value; - const addToolCalls = liteMcpInstance.addTool.mock.calls; - const listDevicesTool = addToolCalls.find((call: { 0: Tool }) => call[0].name === 'list_devices')?.[0] as Tool; + const listDevicesTool = addToolCalls.find(call => call[0].name === 'list_devices')?.[0]; + expect(listDevicesTool).toBeDefined(); + + if (!listDevicesTool) { + throw new Error('list_devices tool not found'); + } // Execute the tool const result = (await listDevicesTool.execute({})) as TestResponse; @@ -197,9 +251,12 @@ describe('Home Assistant MCP Server', () => { mockFetch.mockRejectedValueOnce(new Error('Network error')); // Get the tool registration - const liteMcpInstance = (LiteMCP as jest.MockedClass).mock.results[0].value; - const addToolCalls = liteMcpInstance.addTool.mock.calls; - const listDevicesTool = addToolCalls.find((call: { 0: Tool }) => call[0].name === 'list_devices')?.[0] as Tool; + const listDevicesTool = addToolCalls.find(call => call[0].name === 'list_devices')?.[0]; + expect(listDevicesTool).toBeDefined(); + + if (!listDevicesTool) { + throw new Error('list_devices tool not found'); + } // Execute the tool const result = (await listDevicesTool.execute({})) as TestResponse; @@ -219,9 +276,12 @@ describe('Home Assistant MCP Server', () => { } as Response); // Get the tool registration - const liteMcpInstance = (LiteMCP as jest.MockedClass).mock.results[0].value; - const addToolCalls = liteMcpInstance.addTool.mock.calls; - const controlTool = addToolCalls.find((call: { 0: Tool }) => call[0].name === 'control')?.[0] as Tool; + const controlTool = addToolCalls.find(call => call[0].name === 'control')?.[0]; + expect(controlTool).toBeDefined(); + + if (!controlTool) { + throw new Error('control tool not found'); + } // Execute the tool const result = (await controlTool.execute({ @@ -253,9 +313,12 @@ describe('Home Assistant MCP Server', () => { it('should handle unsupported domains', async () => { // Get the tool registration - const liteMcpInstance = (LiteMCP as jest.MockedClass).mock.results[0].value; - const addToolCalls = liteMcpInstance.addTool.mock.calls; - const controlTool = addToolCalls.find((call: { 0: Tool }) => call[0].name === 'control')?.[0] as Tool; + const controlTool = addToolCalls.find(call => call[0].name === 'control')?.[0]; + expect(controlTool).toBeDefined(); + + if (!controlTool) { + throw new Error('control tool not found'); + } // Execute the tool with an unsupported domain const result = (await controlTool.execute({ @@ -276,9 +339,12 @@ describe('Home Assistant MCP Server', () => { } as Response); // Get the tool registration - const liteMcpInstance = (LiteMCP as jest.MockedClass).mock.results[0].value; - const addToolCalls = liteMcpInstance.addTool.mock.calls; - const controlTool = addToolCalls.find((call: { 0: Tool }) => call[0].name === 'control')?.[0] as Tool; + const controlTool = addToolCalls.find(call => call[0].name === 'control')?.[0]; + expect(controlTool).toBeDefined(); + + if (!controlTool) { + throw new Error('control tool not found'); + } // Execute the tool const result = (await controlTool.execute({ @@ -299,9 +365,12 @@ describe('Home Assistant MCP Server', () => { } as Response); // Get the tool registration - const liteMcpInstance = (LiteMCP as jest.MockedClass).mock.results[0].value; - const addToolCalls = liteMcpInstance.addTool.mock.calls; - const controlTool = addToolCalls.find((call: { 0: Tool }) => call[0].name === 'control')?.[0] as Tool; + const controlTool = addToolCalls.find(call => call[0].name === 'control')?.[0]; + expect(controlTool).toBeDefined(); + + if (!controlTool) { + throw new Error('control tool not found'); + } // Execute the tool const result = (await controlTool.execute({ @@ -343,9 +412,12 @@ describe('Home Assistant MCP Server', () => { } as Response); // Get the tool registration - const liteMcpInstance = (LiteMCP as jest.MockedClass).mock.results[0].value; - const addToolCalls = liteMcpInstance.addTool.mock.calls; - const controlTool = addToolCalls.find((call: { 0: Tool }) => call[0].name === 'control')?.[0] as Tool; + const controlTool = addToolCalls.find(call => call[0].name === 'control')?.[0]; + expect(controlTool).toBeDefined(); + + if (!controlTool) { + throw new Error('control tool not found'); + } // Execute the tool const result = (await controlTool.execute({ @@ -399,9 +471,12 @@ describe('Home Assistant MCP Server', () => { } as Response); // Get the tool registration - const liteMcpInstance = (LiteMCP as jest.MockedClass).mock.results[0].value; - const addToolCalls = liteMcpInstance.addTool.mock.calls; - const historyTool = addToolCalls.find((call: { 0: Tool }) => call[0].name === 'get_history')?.[0] as Tool; + const historyTool = addToolCalls.find(call => call[0].name === 'get_history')?.[0]; + expect(historyTool).toBeDefined(); + + if (!historyTool) { + throw new Error('get_history tool not found'); + } // Execute the tool const result = (await historyTool.execute({ @@ -438,9 +513,12 @@ describe('Home Assistant MCP Server', () => { it('should handle fetch errors', async () => { mockFetch.mockRejectedValueOnce(new Error('Network error')); - const liteMcpInstance = (LiteMCP as jest.MockedClass).mock.results[0].value; - const addToolCalls = liteMcpInstance.addTool.mock.calls; - const historyTool = addToolCalls.find((call: { 0: Tool }) => call[0].name === 'get_history')?.[0] as Tool; + const historyTool = addToolCalls.find(call => call[0].name === 'get_history')?.[0]; + expect(historyTool).toBeDefined(); + + if (!historyTool) { + throw new Error('get_history tool not found'); + } const result = (await historyTool.execute({ entity_id: 'light.living_room' @@ -477,9 +555,12 @@ describe('Home Assistant MCP Server', () => { json: async () => mockScenes } as Response); - const liteMcpInstance = (LiteMCP as jest.MockedClass).mock.results[0].value; - const addToolCalls = liteMcpInstance.addTool.mock.calls; - const sceneTool = addToolCalls.find((call: { 0: Tool }) => call[0].name === 'scene')?.[0] as Tool; + const sceneTool = addToolCalls.find(call => call[0].name === 'scene')?.[0]; + expect(sceneTool).toBeDefined(); + + if (!sceneTool) { + throw new Error('scene tool not found'); + } const result = (await sceneTool.execute({ action: 'list' @@ -506,9 +587,12 @@ describe('Home Assistant MCP Server', () => { json: async () => ({}) } as Response); - const liteMcpInstance = (LiteMCP as jest.MockedClass).mock.results[0].value; - const addToolCalls = liteMcpInstance.addTool.mock.calls; - const sceneTool = addToolCalls.find((call: { 0: Tool }) => call[0].name === 'scene')?.[0] as Tool; + const sceneTool = addToolCalls.find(call => call[0].name === 'scene')?.[0]; + expect(sceneTool).toBeDefined(); + + if (!sceneTool) { + throw new Error('scene tool not found'); + } const result = (await sceneTool.execute({ action: 'activate', @@ -541,9 +625,12 @@ describe('Home Assistant MCP Server', () => { json: async () => ({}) } as Response); - const liteMcpInstance = (LiteMCP as jest.MockedClass).mock.results[0].value; - const addToolCalls = liteMcpInstance.addTool.mock.calls; - const notifyTool = addToolCalls.find((call: { 0: Tool }) => call[0].name === 'notify')?.[0] as Tool; + const notifyTool = addToolCalls.find(call => call[0].name === 'notify')?.[0]; + expect(notifyTool).toBeDefined(); + + if (!notifyTool) { + throw new Error('notify tool not found'); + } const result = (await notifyTool.execute({ message: 'Test notification', @@ -578,9 +665,12 @@ describe('Home Assistant MCP Server', () => { json: async () => ({}) } as Response); - const liteMcpInstance = (LiteMCP as jest.MockedClass).mock.results[0].value; - const addToolCalls = liteMcpInstance.addTool.mock.calls; - const notifyTool = addToolCalls.find((call: { 0: Tool }) => call[0].name === 'notify')?.[0] as Tool; + const notifyTool = addToolCalls.find(call => call[0].name === 'notify')?.[0]; + expect(notifyTool).toBeDefined(); + + if (!notifyTool) { + throw new Error('notify tool not found'); + } await notifyTool.execute({ message: 'Test notification' @@ -619,9 +709,12 @@ describe('Home Assistant MCP Server', () => { json: async () => mockAutomations } as Response); - const liteMcpInstance = (LiteMCP as jest.MockedClass).mock.results[0].value; - const addToolCalls = liteMcpInstance.addTool.mock.calls; - const automationTool = addToolCalls.find((call: { 0: Tool }) => call[0].name === 'automation')?.[0] as Tool; + const automationTool = addToolCalls.find(call => call[0].name === 'automation')?.[0]; + expect(automationTool).toBeDefined(); + + if (!automationTool) { + throw new Error('automation tool not found'); + } const result = (await automationTool.execute({ action: 'list' @@ -650,9 +743,12 @@ describe('Home Assistant MCP Server', () => { json: async () => ({}) } as Response); - const liteMcpInstance = (LiteMCP as jest.MockedClass).mock.results[0].value; - const addToolCalls = liteMcpInstance.addTool.mock.calls; - const automationTool = addToolCalls.find((call: { 0: Tool }) => call[0].name === 'automation')?.[0] as Tool; + const automationTool = addToolCalls.find(call => call[0].name === 'automation')?.[0]; + expect(automationTool).toBeDefined(); + + if (!automationTool) { + throw new Error('automation tool not found'); + } const result = (await automationTool.execute({ action: 'toggle', @@ -683,9 +779,12 @@ describe('Home Assistant MCP Server', () => { json: async () => ({}) } as Response); - const liteMcpInstance = (LiteMCP as jest.MockedClass).mock.results[0].value; - const addToolCalls = liteMcpInstance.addTool.mock.calls; - const automationTool = addToolCalls.find((call: { 0: Tool }) => call[0].name === 'automation')?.[0] as Tool; + const automationTool = addToolCalls.find(call => call[0].name === 'automation')?.[0]; + expect(automationTool).toBeDefined(); + + if (!automationTool) { + throw new Error('automation tool not found'); + } const result = (await automationTool.execute({ action: 'trigger', @@ -711,9 +810,12 @@ describe('Home Assistant MCP Server', () => { }); it('should require automation_id for toggle and trigger actions', async () => { - const liteMcpInstance = (LiteMCP as jest.MockedClass).mock.results[0].value; - const addToolCalls = liteMcpInstance.addTool.mock.calls; - const automationTool = addToolCalls.find((call: { 0: Tool }) => call[0].name === 'automation')?.[0] as Tool; + const automationTool = addToolCalls.find(call => call[0].name === 'automation')?.[0]; + expect(automationTool).toBeDefined(); + + if (!automationTool) { + throw new Error('automation tool not found'); + } const result = (await automationTool.execute({ action: 'toggle' @@ -756,9 +858,12 @@ describe('Home Assistant MCP Server', () => { json: async () => mockAddons } as Response); - const liteMcpInstance = (LiteMCP as jest.MockedClass).mock.results[0].value; - const addToolCalls = liteMcpInstance.addTool.mock.calls; - const addonTool = addToolCalls.find((call: { 0: Tool }) => call[0].name === 'addon')?.[0] as Tool; + const addonTool = addToolCalls.find(call => call[0].name === 'addon')?.[0]; + expect(addonTool).toBeDefined(); + + if (!addonTool) { + throw new Error('addon tool not found'); + } const result = (await addonTool.execute({ action: 'list' @@ -774,9 +879,12 @@ describe('Home Assistant MCP Server', () => { json: async () => ({ data: { state: 'installing' } }) } as Response); - const liteMcpInstance = (LiteMCP as jest.MockedClass).mock.results[0].value; - const addToolCalls = liteMcpInstance.addTool.mock.calls; - const addonTool = addToolCalls.find((call: { 0: Tool }) => call[0].name === 'addon')?.[0] as Tool; + const addonTool = addToolCalls.find(call => call[0].name === 'addon')?.[0]; + expect(addonTool).toBeDefined(); + + if (!addonTool) { + throw new Error('addon tool not found'); + } const result = (await addonTool.execute({ action: 'install', @@ -823,9 +931,12 @@ describe('Home Assistant MCP Server', () => { json: async () => mockPackages } as Response); - const liteMcpInstance = (LiteMCP as jest.MockedClass).mock.results[0].value; - const addToolCalls = liteMcpInstance.addTool.mock.calls; - const packageTool = addToolCalls.find((call: { 0: Tool }) => call[0].name === 'package')?.[0] as Tool; + const packageTool = addToolCalls.find(call => call[0].name === 'package')?.[0]; + expect(packageTool).toBeDefined(); + + if (!packageTool) { + throw new Error('package tool not found'); + } const result = (await packageTool.execute({ action: 'list', @@ -842,9 +953,12 @@ describe('Home Assistant MCP Server', () => { json: async () => ({}) } as Response); - const liteMcpInstance = (LiteMCP as jest.MockedClass).mock.results[0].value; - const addToolCalls = liteMcpInstance.addTool.mock.calls; - const packageTool = addToolCalls.find((call: { 0: Tool }) => call[0].name === 'package')?.[0] as Tool; + const packageTool = addToolCalls.find(call => call[0].name === 'package')?.[0]; + expect(packageTool).toBeDefined(); + + if (!packageTool) { + throw new Error('package tool not found'); + } const result = (await packageTool.execute({ action: 'install', @@ -902,9 +1016,12 @@ describe('Home Assistant MCP Server', () => { json: async () => ({ automation_id: 'new_automation_1' }) } as Response); - const liteMcpInstance = (LiteMCP as jest.MockedClass).mock.results[0].value; - const addToolCalls = liteMcpInstance.addTool.mock.calls; - const automationConfigTool = addToolCalls.find((call: { 0: Tool }) => call[0].name === 'automation_config')?.[0] as Tool; + const automationConfigTool = addToolCalls.find(call => call[0].name === 'automation_config')?.[0]; + expect(automationConfigTool).toBeDefined(); + + if (!automationConfigTool) { + throw new Error('automation_config tool not found'); + } const result = (await automationConfigTool.execute({ action: 'create', @@ -941,9 +1058,12 @@ describe('Home Assistant MCP Server', () => { json: async () => ({ automation_id: 'new_automation_2' }) } as Response); - const liteMcpInstance = (LiteMCP as jest.MockedClass).mock.results[0].value; - const addToolCalls = liteMcpInstance.addTool.mock.calls; - const automationConfigTool = addToolCalls.find((call: { 0: Tool }) => call[0].name === 'automation_config')?.[0] as Tool; + const automationConfigTool = addToolCalls.find(call => call[0].name === 'automation_config')?.[0]; + expect(automationConfigTool).toBeDefined(); + + if (!automationConfigTool) { + throw new Error('automation_config tool not found'); + } const result = (await automationConfigTool.execute({ action: 'duplicate', @@ -975,9 +1095,12 @@ describe('Home Assistant MCP Server', () => { }); it('should require config for create action', async () => { - const liteMcpInstance = (LiteMCP as jest.MockedClass).mock.results[0].value; - const addToolCalls = liteMcpInstance.addTool.mock.calls; - const automationConfigTool = addToolCalls.find((call: { 0: Tool }) => call[0].name === 'automation_config')?.[0] as Tool; + const automationConfigTool = addToolCalls.find(call => call[0].name === 'automation_config')?.[0]; + expect(automationConfigTool).toBeDefined(); + + if (!automationConfigTool) { + throw new Error('automation_config tool not found'); + } const result = (await automationConfigTool.execute({ action: 'create' @@ -988,9 +1111,12 @@ describe('Home Assistant MCP Server', () => { }); it('should require automation_id for update action', async () => { - const liteMcpInstance = (LiteMCP as jest.MockedClass).mock.results[0].value; - const addToolCalls = liteMcpInstance.addTool.mock.calls; - const automationConfigTool = addToolCalls.find((call: { 0: Tool }) => call[0].name === 'automation_config')?.[0] as Tool; + const automationConfigTool = addToolCalls.find(call => call[0].name === 'automation_config')?.[0]; + expect(automationConfigTool).toBeDefined(); + + if (!automationConfigTool) { + throw new Error('automation_config tool not found'); + } const result = (await automationConfigTool.execute({ action: 'update', diff --git a/coverage/lcov-report/index.html b/coverage/lcov-report/index.html index 4de504c..f25d287 100644 --- a/coverage/lcov-report/index.html +++ b/coverage/lcov-report/index.html @@ -23,30 +23,30 @@
- 37.98% + 22.12% Statements - 128/337 + 260/1175
- 33.06% + 19.23% Branches - 41/124 + 85/442
- 37.5% + 25.22% Functions - 33/88 + 57/226
- 38.34% + 22.2% Lines - 125/326 + 254/1144
@@ -79,18 +79,78 @@ - src - -
+ src + +
- 100% - 33/33 - 100% - 1/1 - 100% - 1/1 - 100% - 33/33 + 11.14% + 33/296 + 0.71% + 1/139 + 5% + 1/20 + 11.22% + 33/294 + + + + src/ai/endpoints + +
+ + 0% + 0/39 + 0% + 0/7 + 0% + 0/8 + 0% + 0/38 + + + + src/ai/nlp + +
+ + 25.37% + 34/134 + 23.8% + 15/63 + 16.66% + 5/30 + 25.95% + 34/131 + + + + src/ai/templates + +
+ + 0% + 0/15 + 0% + 0/2 + 0% + 0/8 + 0% + 0/15 + + + + src/ai/types + +
+ + 0% + 0/10 + 0% + 0/2 + 0% + 0/1 + 0% + 0/10 @@ -124,48 +184,108 @@ - src/hass - -
+ src/hass + +
- 87.5% - 7/8 - 40% - 2/5 - 50% - 1/2 - 87.5% - 7/8 + 23.42% + 26/111 + 19.51% + 8/41 + 13.04% + 3/23 + 23.42% + 26/111 src/performance - -
+ +
- 0% - 0/67 - 0% - 0/22 - 0% - 0/21 - 0% - 0/60 + 26.86% + 18/67 + 63.63% + 14/22 + 33.33% + 7/21 + 28.33% + 17/60 - src/security + src/platforms/macos
0% - 0/57 + 0/82 0% - 0/22 + 0/25 0% - 0/7 + 0/13 0% - 0/56 + 0/79 + + + + src/schemas + +
+ + 0% + 0/8 + 100% + 0/0 + 100% + 0/0 + 0% + 0/8 + + + + src/security + +
+ + 75.43% + 43/57 + 25% + 5/20 + 57.14% + 4/7 + 75% + 42/56 + + + + src/sse + +
+ + 0% + 0/123 + 0% + 0/29 + 0% + 0/24 + 0% + 0/115 + + + + src/tools + +
+ + 29.5% + 18/61 + 22.22% + 4/18 + 42.85% + 6/14 + 29.31% + 17/58 @@ -191,7 +311,7 @@