Skip to main content
Glama
test.js1.25 kB
/** * Tests for the helper functions */ const assert = require('assert'); const { formatDate, capitalize } = require('../src/utils/helpers'); const { main } = require('../src/index'); // Test the formatDate function describe('formatDate', () => { it('should format a date to ISO string', () => { const testDate = new Date('2023-01-01T12:00:00Z'); const result = formatDate(testDate); assert.strictEqual(result, '2023-01-01T12:00:00.000Z'); }); }); // Test the capitalize function describe('capitalize', () => { it('should capitalize the first letter of a string', () => { const result = capitalize('hello'); assert.strictEqual(result, 'Hello'); }); it('should handle empty strings', () => { const result = capitalize(''); assert.strictEqual(result, ''); }); it('should handle null inputs', () => { const result = capitalize(null); assert.strictEqual(result, ''); }); }); // Test the main function describe('main', () => { it('should return a formatted date string', () => { const result = main(); // Verify the result is a string and matches ISO format assert(typeof result === 'string'); assert(/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.\d{3}Z$/.test(result)); }); });

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/nicobailon/code-summarizer'

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