Skip to main content
Glama
deleteAiAction.test.ts1.54 kB
import { describe, it, expect, beforeEach, vi } from 'vitest'; import { deleteAiActionTool } from './deleteAiAction.js'; import { formatResponse } from '../../utils/formatters.js'; import { setupMockClient, mockAiActionDelete, mockArgs, mockAiAction, mockAiActionGet, } from './mockClient.js'; import { createMockConfig } from '../../test-helpers/mockConfig.js'; vi.mock('../../../src/utils/tools.js'); describe('deleteAiAction', () => { const mockConfig = createMockConfig(); beforeEach(() => { setupMockClient(); }); it('should delete an AI action successfully', async () => { mockAiActionGet.mockResolvedValue(mockAiAction); mockAiActionDelete.mockResolvedValue(undefined); const tool = deleteAiActionTool(mockConfig); const result = await tool(mockArgs); const expectedResponse = formatResponse('AI action deleted successfully', { aiAction: mockAiAction, }); expect(result).toEqual({ content: [ { type: 'text', text: expectedResponse, }, ], }); }); it('should handle errors when AI action deletion fails', async () => { const error = new Error('AI action not found'); mockAiActionDelete.mockRejectedValue(error); const tool = deleteAiActionTool(mockConfig); const result = await tool(mockArgs); expect(result).toEqual({ isError: true, content: [ { type: 'text', text: 'Error deleting AI action: AI action not found', }, ], }); }); });

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/contentful/contentful-mcp-server'

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