Skip to main content
Glama
by sinch
utils.test.ts•1.58 kB
import { matchesAnyTag } from '../src/utils'; describe('hasMatchingTag', () => { test('should return true when there is a common tag', () => { const tags = ['apple šŸŽ', 'banana šŸŒ', 'orange šŸŠ']; const filteringTags = ['banana šŸŒ', 'grape šŸ‡']; expect(matchesAnyTag(tags, filteringTags)).toBeTruthy(); }); test('should return false when there are no common tags', () => { const tags = ['apple šŸŽ', 'banana šŸŒ', 'orange šŸŠ']; const filteringTags = ['grape šŸ‡', 'kiwi šŸ„']; expect(matchesAnyTag(tags, filteringTags)).toBeFalsy(); }); test('should return false when tags array is empty (i.e. deactivated tool)', () => { const tags: string[] = []; const filteringTags = ['apple šŸŽ', 'banana šŸŒ']; expect(matchesAnyTag(tags, filteringTags)).toBeFalsy(); }); test('should return true when no filtering tag are provided (i.e. all tools are activated)', () => { const tags = ['apple šŸŽ', 'banana šŸŒ', 'orange šŸŠ']; const filteringTags: string[] = []; expect(matchesAnyTag(tags, filteringTags)).toBeTruthy(); }); test('should match even if casing if different', () => { const tags = ['banana šŸŒ']; const filteringTags = ['BANANA šŸŒ']; expect(matchesAnyTag(tags, filteringTags)).toBeTruthy(); }); test('should return true when multiple common tags exist', () => { const tags = ['apple šŸŽ', 'banana šŸŒ', 'orange šŸŠ']; const filteringTags = ['banana šŸŒ', 'orange šŸŠ', 'grape šŸ‡']; expect(matchesAnyTag(tags, filteringTags)).toBeTruthy(); }); });

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

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