Skip to main content
Glama

Feishu/Lark OpenAPI MCP

Official
by larksuite
parser-string-array.test.ts2.71 kB
import { parseStringArray } from '../../src/utils/parser-string-array'; describe('parseStringArray', () => { it('should return empty array for undefined input', () => { const result = parseStringArray(undefined); expect(result).toEqual([]); }); it('should return empty array for null input', () => { const result = parseStringArray(null as any); expect(result).toEqual([]); }); it('should return empty array for empty string', () => { const result = parseStringArray(''); expect(result).toEqual([]); }); it('should parse comma-separated string', () => { const result = parseStringArray('apple,banana,cherry'); expect(result).toEqual(['apple', 'banana', 'cherry']); }); it('should parse space-separated string', () => { const result = parseStringArray('apple banana cherry'); expect(result).toEqual(['apple', 'banana', 'cherry']); }); it('should parse mixed comma and space-separated string', () => { const result = parseStringArray('apple, banana cherry,orange'); expect(result).toEqual(['apple', 'banana', 'cherry', 'orange']); }); it('should trim whitespace from each item', () => { const result = parseStringArray(' apple , banana , cherry '); expect(result).toEqual(['', 'apple', 'banana', 'cherry', '']); }); it('should handle multiple consecutive separators', () => { const result = parseStringArray('apple,,, banana ,,, cherry'); expect(result).toEqual(['apple', 'banana', 'cherry']); }); it('should handle string array input and trim each item', () => { const result = parseStringArray([' apple ', ' banana ', ' cherry ']); expect(result).toEqual(['apple', 'banana', 'cherry']); }); it('should handle empty string array', () => { const result = parseStringArray([]); expect(result).toEqual([]); }); it('should handle array with empty strings', () => { const result = parseStringArray(['apple', '', 'banana', ' ', 'cherry']); expect(result).toEqual(['apple', '', 'banana', '', 'cherry']); }); it('should handle single item string', () => { const result = parseStringArray('apple'); expect(result).toEqual(['apple']); }); it('should handle single item array', () => { const result = parseStringArray(['apple']); expect(result).toEqual(['apple']); }); it('should handle string with only separators', () => { const result = parseStringArray(',,, '); expect(result).toEqual(['', '']); }); it('should handle complex mixed separators', () => { const result = parseStringArray('apple,banana orange\tpear,\n\rgrape'); expect(result).toEqual(['apple', 'banana', 'orange', 'pear', 'grape']); }); });

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/larksuite/lark-openapi-mcp'

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