Skip to main content
Glama
field-name-validation.jsβ€’3.34 kB
#!/usr/bin/env node /** * Field Name Validation Test * Verifies the critical field name fixes are working correctly */ import { createComposerFormatter } from '../src/tools/format-for-composer.js'; // Test data with quiz, list, and hotspots const testData = { metadata: { topic: "Test Field Names", subject: "MatemΓ‘tica", gradeLevel: "6ΒΊ ano" }, widgets: [ { type: "quiz-1", content: { questions: [ { question: "Test question?", options: ["A", "B", "C"], correct_option: 1 } ] } }, { type: "list-1", content: { items: ["Item 1", "Item 2", "Item 3"] } }, { type: "hotspots-1", content: { background_image: "https://example.com/image.jpg", markers: [ { x: 50, y: 30, title: "Point 1", content: "Test content" }, { x: "20%", y: "40%", title: "Point 2", content: "Test content" } ] } } ] }; async function testFieldNames() { console.error('πŸ”§ Testing Critical Field Name Fixes\n'); const formatter = createComposerFormatter(); const result = await formatter.formatForComposer(testData); if (!result.success) { console.error('❌ Formatting failed:', result.error.message); return; } const structure = result.data.composerJSON.structure; // Test 1: Quiz uses "answers" not "choices" const quizWidget = structure.find(w => w.type === 'quiz-1'); if (quizWidget && quizWidget.questions && quizWidget.questions[0].answers) { console.error('βœ… Quiz widget: Uses "answers" field correctly'); } else { console.error('❌ Quiz widget: Still uses "choices" field'); } // Test 2: List uses "list_items" not "items" const listWidget = structure.find(w => w.type === 'list-1'); if (listWidget && listWidget.list_items) { console.error('βœ… List widget: Uses "list_items" field correctly'); } else { console.error('❌ List widget: Still uses "items" field'); } // Test 3: Hotspots coordinates are strings with percentages const hotspotsWidget = structure.find(w => w.type === 'hotspots-1'); if (hotspotsWidget && hotspotsWidget.marcadores) { const marker1 = hotspotsWidget.marcadores[0]; const marker2 = hotspotsWidget.marcadores[1]; if (marker1.x === "50%" && marker1.y === "30%") { console.error('βœ… Hotspots widget: Numeric coordinates converted to percentages'); } else { console.error('❌ Hotspots widget: Coordinates not converted properly'); console.error(` Expected: "50%", "30%" Got: "${marker1.x}", "${marker1.y}"`); } if (marker2.x === "20%" && marker2.y === "40%") { console.error('βœ… Hotspots widget: String percentages preserved correctly'); } else { console.error('❌ Hotspots widget: String percentages modified incorrectly'); } } else { console.error('❌ Hotspots widget: marcadores field missing'); } console.error('\nπŸ“‹ Field Name Fix Summary:'); console.error(' Quiz: choices β†’ answers'); console.error(' List: items β†’ list_items'); console.error(' Hotspots: numeric coordinates β†’ percentage strings'); console.error('\nβœ… All critical field name fixes verified'); } testFieldNames().catch(console.error);

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/rkm097git/euconquisto-composer-mcp-poc'

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