list-macros.test.ts•1.56 kB
import { test, expect, describe } from './test-fixtures.js';
describe('List Macros Test', () => {
test('should return available macros from fixture roots', async ({ client }) => {
const result = await client.callTool({
name: 'list_macros',
arguments: {},
});
const content = result.content as Array<{ type: string; text: string }>;
const data = JSON.parse(content[0]?.text || '{}');
expect(data.macros).toBeDefined();
expect(Array.isArray(data.macros)).toBe(true);
// Should have macros from fixture directories
expect(data.macros.length).toBeGreaterThan(0);
// Each macro should have name, description, and modulePath
for (const macro of data.macros) {
expect(macro.name).toBeDefined();
expect(typeof macro.name).toBe('string');
expect(macro.description).toBeDefined();
expect(typeof macro.description).toBe('string');
expect(macro.modulePath).toBeDefined();
expect(typeof macro.modulePath).toBe('string');
}
});
test('should discover macros from multiple fixture roots', async ({ client }) => {
const result = await client.callTool({
name: 'list_macros',
arguments: {},
});
const content = result.content as Array<{ type: string; text: string }>;
const data = JSON.parse(content[0]?.text || '{}');
const macroNames = data.macros.map((m: { name: string }) => m.name);
// Should have macros from both root1 and root2
expect(macroNames).toContain('addNumbers');
expect(macroNames).toContain('greet');
});
});