Skip to main content
Glama
test-field-order.js•1.46 kB
#!/usr/bin/env node /** * Test Script: Field Order Issue Analysis * Tests whether JSON.stringify preserves field order in quiz choices */ // Test the exact structure from our format-for-composer.js const correctQuizChoice = { id: "test-id-123", correct: true, text: "<p>Test choice text</p>" }; // Test structure with fields in wrong order (as saved) const wrongOrderChoice = { id: "test-id-123", text: "<p>Test choice text</p>", correct: true }; console.log("=== Field Order Test ==="); console.log("\nCorrect Order (correct before text):"); console.log(JSON.stringify(correctQuizChoice, null, 2)); console.log("\nWrong Order (text before correct):"); console.log(JSON.stringify(wrongOrderChoice, null, 2)); console.log("\n=== Reconstructed Object Test ==="); // Test if reconstruction changes order const reconstructed = JSON.parse(JSON.stringify(correctQuizChoice)); console.log("Reconstructed from correct order:"); console.log(JSON.stringify(reconstructed, null, 2)); console.log("\n=== Object.keys() Order Test ==="); console.log("Correct choice keys:", Object.keys(correctQuizChoice)); console.log("Wrong choice keys:", Object.keys(wrongOrderChoice)); console.log("\n=== Spread Operator Test ==="); const spreadCorrect = { ...correctQuizChoice }; const spreadWrong = { ...wrongOrderChoice }; console.log("Spread correct:", JSON.stringify(spreadCorrect, null, 2)); console.log("Spread wrong:", JSON.stringify(spreadWrong, null, 2));

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