Rocky_Mountain_Vending/.pnpm-store/v10/files/2b/6acc5dfd5cbf86d957df6d81b3b736aed164230a77e8f3edf606e43e1250f14990f473d7379a2bf4367021b4f01ea273ecb658c638c30fec715259e58b2a04
DMleadgen 46d973904b
Initial commit: Rocky Mountain Vending website
Next.js website for Rocky Mountain Vending company featuring:
- Product catalog with Stripe integration
- Service areas and parts pages
- Admin dashboard with Clerk authentication
- SEO optimized pages with JSON-LD structured data

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-12 16:22:15 -07:00

107 lines
No EOL
3.5 KiB
Text

/**
* @jest-environment node
*/ "use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
const _build = require("./build");
describe('MCP Telemetry Events', ()=>{
it('should generate correct telemetry events for single tool', ()=>{
const usages = [
{
featureName: 'mcp/get_errors',
invocationCount: 5
}
];
const events = (0, _build.eventMcpToolUsage)(usages);
expect(events).toHaveLength(1);
expect(events[0]).toEqual({
eventName: _build.EVENT_MCP_TOOL_USAGE,
payload: {
toolName: 'mcp/get_errors',
invocationCount: 5
}
});
});
it('should generate correct telemetry events for multiple tools', ()=>{
const usages = [
{
featureName: 'mcp/get_errors',
invocationCount: 3
},
{
featureName: 'mcp/get_logs',
invocationCount: 1
},
{
featureName: 'mcp/get_page_metadata',
invocationCount: 7
}
];
const events = (0, _build.eventMcpToolUsage)(usages);
expect(events).toHaveLength(3);
expect(events[0]).toEqual({
eventName: _build.EVENT_MCP_TOOL_USAGE,
payload: {
toolName: 'mcp/get_errors',
invocationCount: 3
}
});
expect(events[1]).toEqual({
eventName: _build.EVENT_MCP_TOOL_USAGE,
payload: {
toolName: 'mcp/get_logs',
invocationCount: 1
}
});
expect(events[2]).toEqual({
eventName: _build.EVENT_MCP_TOOL_USAGE,
payload: {
toolName: 'mcp/get_page_metadata',
invocationCount: 7
}
});
});
it('should handle all MCP tool types', ()=>{
const allTools = [
'mcp/get_errors',
'mcp/get_logs',
'mcp/get_page_metadata',
'mcp/get_project_metadata',
'mcp/get_server_action_by_id'
];
const usages = allTools.map((tool, index)=>({
featureName: tool,
invocationCount: index + 1
}));
const events = (0, _build.eventMcpToolUsage)(usages);
expect(events).toHaveLength(5);
events.forEach((event, index)=>{
expect(event.eventName).toBe(_build.EVENT_MCP_TOOL_USAGE);
expect(event.payload.toolName).toBe(allTools[index]);
expect(event.payload.invocationCount).toBe(index + 1);
});
});
it('should handle empty usage array', ()=>{
const events = (0, _build.eventMcpToolUsage)([]);
expect(events).toEqual([]);
});
it('should use correct event name constant', ()=>{
expect(_build.EVENT_MCP_TOOL_USAGE).toBe('NEXT_MCP_TOOL_USAGE');
});
it('should transform featureName to toolName in payload', ()=>{
const usages = [
{
featureName: 'mcp/get_project_metadata',
invocationCount: 2
}
];
const events = (0, _build.eventMcpToolUsage)(usages);
// Verify the input has 'featureName' but output has 'toolName'
expect(usages[0]).toHaveProperty('featureName');
expect(events[0].payload).toHaveProperty('toolName');
expect(events[0].payload).not.toHaveProperty('featureName');
});
});
//# sourceMappingURL=mcp-telemetry.test.js.map