Skip to main content
Glama
final-coverage-push.test.ts6.16 kB
/** * Final tests to push branch coverage above 81% */ import { convertColorTool } from '../../src/tools/convert-color'; import { createPaletteHtmlTool } from '../../src/tools/create-palette-html'; import { createColorWheelHtmlTool } from '../../src/tools/create-color-wheel-html'; import { simulateColorblindnessTool } from '../../src/tools/simulate-colorblindness'; describe('Final Coverage Push', () => { describe('Convert Color - Specific Branches', () => { it('should handle precision edge cases', async () => { // Test with precision exactly at boundaries const result1 = await convertColorTool.handler({ color: '#FF0000', output_format: 'hsl', precision: 0, // Minimum }); expect(result1.success).toBe(true); const result2 = await convertColorTool.handler({ color: '#FF0000', output_format: 'hsl', precision: 10, // Maximum }); expect(result2.success).toBe(true); }); it('should handle variable names with different formats', async () => { const result1 = await convertColorTool.handler({ color: '#FF0000', output_format: 'css-var', variable_name: 'my-color', }); expect(result1.success).toBe(true); const result2 = await convertColorTool.handler({ color: '#FF0000', output_format: 'scss-var', variable_name: 'my_color', }); expect(result2.success).toBe(true); const result3 = await convertColorTool.handler({ color: '#FF0000', output_format: 'tailwind', variable_name: 'primary', }); expect(result3.success).toBe(true); }); }); describe('HTML Tools - Specific Branches', () => { it('should handle palette HTML with custom dimensions', async () => { const result = await createPaletteHtmlTool.handler({ palette: ['#FF0000', '#00FF00'], size: 'custom', custom_dimensions: [800, 600], }); expect(result.success).toBe(true); }); it('should handle color wheel with different themes', async () => { const result1 = await createColorWheelHtmlTool.handler({ theme: 'dark', }); expect(result1.success).toBe(true); const result2 = await createColorWheelHtmlTool.handler({ theme: 'auto', }); expect(result2.success).toBe(true); }); it('should handle color wheel with highlight colors', async () => { const result = await createColorWheelHtmlTool.handler({ highlight_colors: ['#FF0000', '#00FF00'], }); expect(result.success).toBe(true); }); }); describe('Colorblindness - Specific Branches', () => { it('should handle different severity levels', async () => { const result1 = await simulateColorblindnessTool.handler({ colors: ['#FF0000', '#00FF00'], type: 'protanopia', severity: 25, }); expect(result1.success).toBe(true); const result2 = await simulateColorblindnessTool.handler({ colors: ['#FF0000', '#00FF00'], type: 'deuteranopia', severity: 75, }); expect(result2.success).toBe(true); }); it('should handle all deficiency types', async () => { const types = [ 'protanomaly', 'deuteranomaly', 'tritanomaly', 'monochromacy', ]; for (const type of types) { const result = await simulateColorblindnessTool.handler({ colors: ['#FF0000'], type: type as any, }); expect(result.success).toBe(true); } }); }); describe('Parameter Validation - Edge Cases', () => { it('should handle string length validations', async () => { // Test with very short valid color const result1 = await convertColorTool.handler({ color: 'red', output_format: 'hex', }); expect(result1.success).toBe(true); // Test with longer valid color const result2 = await convertColorTool.handler({ color: 'rgba(255, 128, 64, 0.75)', output_format: 'hsl', }); expect(result2.success).toBe(true); }); it('should handle array validations', async () => { // Test with single color array const result1 = await createPaletteHtmlTool.handler({ palette: ['#FF0000'], }); expect(result1.success).toBe(true); // Test with maximum reasonable array size const largePalette = Array.from( { length: 20 }, (_, i) => `hsl(${i * 18}, 70%, 50%)` ); const result2 = await createPaletteHtmlTool.handler({ palette: largePalette, }); expect(result2.success).toBe(true); }); }); describe('Optional Parameters', () => { it('should handle tools with minimal parameters', async () => { const result1 = await createColorWheelHtmlTool.handler({}); expect(result1.success).toBe(true); const result2 = await simulateColorblindnessTool.handler({ colors: ['#FF0000'], type: 'protanopia', // severity omitted - should use default }); expect(result2.success).toBe(true); }); it('should handle partial parameter combinations', async () => { const result = await createPaletteHtmlTool.handler({ palette: ['#FF0000', '#00FF00'], show_values: false, interactive: false, // Other parameters use defaults }); expect(result.success).toBe(true); }); }); describe('Format-Specific Branches', () => { it('should handle all advanced color formats', async () => { const formats = ['hwb', 'lch', 'oklab', 'oklch']; for (const format of formats) { const result = await convertColorTool.handler({ color: '#FF0000', output_format: format, precision: 3, }); expect(result.success).toBe(true); } }); it('should handle named color output', async () => { const result = await convertColorTool.handler({ color: '#FF0000', output_format: 'named', }); expect(result.success).toBe(true); }); }); });

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/keyurgolani/ColorMcp'

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