Skip to main content
Glama
readGraph.test.ts891 B
import { describe, it, expect, vi } from 'vitest'; import { handleReadGraph } from '../readGraph.js'; describe('handleReadGraph', () => { it('should call readGraph and return the formatted result', async () => { // Arrange const mockGraph = { entities: [ { id: '1', name: 'Entity1', type: 'Person' }, { id: '2', name: 'Entity2', type: 'Thing' }, ], relations: [{ id: '1', from: 'Entity1', to: 'Entity2', type: 'KNOWS' }], }; const mockReadGraph = vi.fn().mockResolvedValue(mockGraph); const mockKnowledgeGraphManager = { readGraph: mockReadGraph, }; // Act const result = await handleReadGraph({}, mockKnowledgeGraphManager); // Assert expect(mockReadGraph).toHaveBeenCalled(); expect(result.content[0].type).toBe('text'); expect(JSON.parse(result.content[0].text)).toEqual(mockGraph); }); });

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/gannonh/memento-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server