Skip to main content
Glama
formatAdf.test.ts1.86 kB
/** * Unit tests for ADF formatting functions. */ import { describe, expect, it } from '@jest/globals' import { convertToAdf, formatDescriptionForAdf } from '../formatAdf' describe('convertToAdf', () => { it('should wrap plain text in a basic ADF paragraph structure', () => { const inputText = 'This is a test.' const expectedAdf = { type: 'doc', version: 1, content: [ { type: 'paragraph', content: [ { type: 'text', text: inputText, }, ], }, ], } const result = convertToAdf(inputText) expect(result).toEqual(expectedAdf) }) }) describe('formatDescriptionForAdf', () => { it('should return ADF for a valid non-empty string', () => { const description = 'Valid description.' const expectedAdf = convertToAdf(description) // Use the tested function const result = formatDescriptionForAdf(description) expect(result).toEqual(expectedAdf) }) it('should return undefined for an empty string', () => { const description = '' const result = formatDescriptionForAdf(description) expect(result).toBeUndefined() }) it('should return undefined for null input', () => { const description = null const result = formatDescriptionForAdf(description) expect(result).toBeUndefined() }) it('should return undefined for undefined input', () => { const description = undefined const result = formatDescriptionForAdf(description) expect(result).toBeUndefined() }) it('should return undefined for non-string input (number)', () => { const description = 12345 const result = formatDescriptionForAdf(description) expect(result).toBeUndefined() }) it('should return undefined for non-string input (object)', () => { const description = { text: 'some description' } const result = formatDescriptionForAdf(description) expect(result).toBeUndefined() }) })

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/tbreeding/jira-mcp'

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