Skip to main content
Glama
createRelations.test.ts872 B
import { describe, test, expect, vi } from 'vitest'; import { handleCreateRelations } from '../createRelations.js'; describe('handleCreateRelations', () => { test('should create relations and return results', async () => { // Arrange const args = { relations: [{ from: 'Entity1', to: 'Entity2', relationType: 'KNOWS' }], }; const mockResult = { success: true }; const mockKnowledgeGraphManager = { createRelations: vi.fn().mockResolvedValue(mockResult), }; // Act const response = await handleCreateRelations(args, mockKnowledgeGraphManager); // Assert expect(mockKnowledgeGraphManager.createRelations).toHaveBeenCalledWith(args.relations); expect(response).toEqual({ content: [ { type: 'text', text: JSON.stringify(mockResult, null, 2), }, ], }); }); });

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