Skip to main content
Glama

mcp-server-cloudflare

Official
by cloudflare
utils.spec.ts1.11 kB
import { describe, expect, it } from 'vitest' import { nowISO, parseRelativeTime } from './utils' describe('parseRelativeTime', () => { it('parses positive relative time correctly', () => { expect(parseRelativeTime('+1h')).toBe(3600) expect(parseRelativeTime('+2d')).toBe(172800) expect(parseRelativeTime('+3w')).toBe(1814400) }) it('parses negative relative time correctly', () => { expect(parseRelativeTime('-1h')).toBe(-3600) expect(parseRelativeTime('-2d')).toBe(-172800) expect(parseRelativeTime('-3w')).toBe(-1814400) }) it('parses mixed units correctly', () => { expect(parseRelativeTime('+1h30m')).toBe(5400) expect(parseRelativeTime('-2d6h')).toBe(-194400) }) it('throws an error for invalid formats', () => { expect(() => parseRelativeTime('1h')).toThrow() expect(() => parseRelativeTime('+')).toThrow() expect(() => parseRelativeTime('')).toThrow() }) }) describe('nowISO', () => { it('returns the current time in ISO format without milliseconds', () => { const isoRegex = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}Z$/ expect(nowISO()).toMatch(isoRegex) }) })

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/cloudflare/mcp-server-cloudflare'

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