Skip to main content
Glama

translator-ai

by DatanoiseTV
dots-escape.test.ts1.37 kB
import { flattenObjectWithPaths, unflattenObject } from '../../src/helpers'; describe('Dot escaping in keys', () => { it('should preserve dots in original keys', () => { const obj = { "auth.login": "Login", "auth.logout": "Logout", "menu": { "home": "Home", "auth.login": "Sign In" } }; const flattened = flattenObjectWithPaths(obj); const unflattened = unflattenObject(flattened); expect(unflattened).toEqual(obj); }); it('should handle the society-flow menu structure', () => { const obj = { "menu": { "legal": "Legal", "legal.terms-of-service": "Terms of Service", "legal.privacy-policy": "Privacy Policy" } }; const flattened = flattenObjectWithPaths(obj); const unflattened = unflattenObject(flattened); expect(unflattened).toEqual(obj); expect((unflattened.menu as any).legal).toBe("Legal"); expect((unflattened.menu as any)["legal.terms-of-service"]).toBe("Terms of Service"); }); it('should handle arrays correctly', () => { const obj = { "items": ["one", "two", "three"], "nested": { "list": ["a", "b"] } }; const flattened = flattenObjectWithPaths(obj); const unflattened = unflattenObject(flattened); expect(unflattened).toEqual(obj); }); });

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/DatanoiseTV/translator-ai'

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