Skip to main content
Glama

Convex MCP server

Official
by get-convex
LogToolbar.test.tsx3.61 kB
import { functionIdentifierValue } from "@common/lib/functions/generateFileTree"; import { functionsForSelectedNents, selectNentOption, } from "@common/features/logs/components/LogToolbar"; describe("selectNentOption", () => { const nents = ["_App", "nent1", "nent2"]; const functions = [ functionIdentifierValue("func1"), functionIdentifierValue("func2", "nent1", "id1"), functionIdentifierValue("func3", "nent1", "id1"), functionIdentifierValue("func4", "nent2", "id2"), ]; let setSelectedFunctions: jest.Mock; let setSelectedNents: jest.Mock; beforeEach(() => { setSelectedFunctions = jest.fn(); setSelectedNents = jest.fn(); }); const testCases = [ { name: "removing all nents removes all functions", nents, functions, newNents: [], expectedSelectedNents: [], expectedSelectedFunctions: "all", }, { name: "removing two nents removes functions related to those nents", nents, functions, newNents: ["_App"], expectedSelectedNents: ["_App"], expectedSelectedFunctions: "all", }, { name: "adding a nent does not add functions related to other nents", nents: ["_App"], functions: [], newNents: ["_App", "nent2"], expectedSelectedNents: ["_App", "nent2"], expectedSelectedFunctions: [ functionIdentifierValue("func1"), functionIdentifierValue("func4", "nent2", "id2"), ], }, ]; testCases.forEach( ({ name, nents: selectedNents, functions: selectedFunctions, newNents, expectedSelectedNents, expectedSelectedFunctions, }) => { test(name, () => { const updateSelectedNents = selectNentOption({ selectedNents, functions, selectedFunctions, setSelectedFunctions, setSelectedNents, }); updateSelectedNents(newNents); expect(setSelectedNents).toHaveBeenCalledWith(expectedSelectedNents); expect(setSelectedFunctions).toHaveBeenCalledWith( expectedSelectedFunctions, ); }); }, ); }); describe("functionsForSelectedNents", () => { const functions = [ functionIdentifierValue("func1"), functionIdentifierValue("func2", "nent1", "id1"), functionIdentifierValue("func3", "nent1", "id1"), functionIdentifierValue("func4", "nent2", "id2"), ]; const testCases = [ { name: "returns all functions when no nents are selected", nents: [], expectedFunctions: functions, }, { name: "returns only functions related to selected nents", nents: ["_App", "nent1"], expectedFunctions: [functions[0], functions[1], functions[2]], }, { name: "returns only functions related to selected nents", nents: ["_App", "nent2"], expectedFunctions: [functions[0], functions[3]], }, { name: "returns all functions when all nents are selected", nents: ["_App", "nent1", "nent2"], expectedFunctions: functions, }, { name: "returns app functions when only _App is selected", nents: ["_App"], expectedFunctions: [functions[0]], }, { name: "returns nent functions when only nent1 and nent2 are selected", nents: ["nent1", "nent2"], expectedFunctions: functions.slice(1), }, ]; testCases.forEach(({ name, nents, expectedFunctions }) => { test(name, () => { const result = functionsForSelectedNents(nents, functions); expect(result).toEqual(expectedFunctions); }); }); });

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/get-convex/convex-backend'

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