Skip to main content
Glama
LassiterJ
by LassiterJ
test.ts.ejs.t•2.53 kB
--- to: tests/<%= name %>.test.ts --- import assert from "node:assert"; import { describe, it } from "node:test"; import { withTestClient } from "./helpers/test-client.ts"; describe("<%= h.changeCase.titleCase(name.replace(/-/g, ' ')) %> Prompt Integration Tests", () => { it("should list <%= name %> prompt", async () => { await withTestClient(async (client) => { const response = await client.listPrompts(); const promptNames = response.prompts.map(p => p.name); assert(promptNames.includes("<%= name %>"), "<%= h.changeCase.titleCase(name.replace(/-/g, ' ')) %> prompt should be listed"); const prompt = response.prompts.find(p => p.name === "<%= name %>"); assert.strictEqual(prompt?.description, "<%= description %>"); }); }); it("should generate prompt with valid topic", async () => { await withTestClient(async (client) => { const testTopic = "test topic"; const response = await client.getPrompt("<%= name %>", { topic: testTopic }); assert(response.messages !== undefined, "Response should have messages"); assert(response.messages.length > 0, "Response should have at least one message"); const firstMessage = response.messages[0]; assert.strictEqual(firstMessage?.role, "user", "First message should be from user"); const content = firstMessage?.content; assert(content !== undefined, "Message should have content"); if (typeof content === "object" && "type" in content && content.type === "text" && "text" in content) { assert(content.text.includes(testTopic), "Prompt should include the topic"); assert(content.text.includes("<%= description %>"), "Prompt should include the description"); } else { assert.fail("Content should be a text object"); } }); }); it("should handle special characters in topic", async () => { await withTestClient(async (client) => { const testTopic = "Special chars: @#$%^&*() 🚀"; const response = await client.getPrompt("<%= name %>", { topic: testTopic }); assert(response.messages !== undefined, "Response should have messages"); const firstMessage = response.messages[0]; const content = firstMessage?.content; if (typeof content === "object" && "type" in content && content.type === "text" && "text" in content) { assert(content.text.includes(testTopic), "Prompt should handle special characters"); } }); }); });

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/LassiterJ/mcp-playground'

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