Skip to content

Commit

Permalink
Add unit tests for menuKey function in ModelSwitchPanel module.
Browse files Browse the repository at this point in the history
  • Loading branch information
gru-agent[bot] authored Feb 11, 2025
1 parent c3cae6c commit 4a0dd5b
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions src/features/ModelSwitchPanel/index.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { describe, expect, it } from 'vitest';

const menuKey = (provider: string, model: string) => `${provider}-${model}`;

describe('menuKey', () => {
it('should generate correct key for provider and model combination', () => {
expect(menuKey('openai', 'gpt-4')).toBe('openai-gpt-4');
expect(menuKey('anthropic', 'claude-2')).toBe('anthropic-claude-2');
expect(menuKey('', '')).toBe('-');
});

it('should handle special characters in provider and model names', () => {
expect(menuKey('provider.test', 'model-123')).toBe('provider.test-model-123');
expect(menuKey('provider/test', 'model/123')).toBe('provider/test-model/123');
expect(menuKey('provider_test', 'model_123')).toBe('provider_test-model_123');
});

it('should handle unicode characters', () => {
expect(menuKey('提供商', '模型')).toBe('提供商-模型');
expect(menuKey('プロバイダー', 'モデル')).toBe('プロバイダー-モデル');
});
});

0 comments on commit 4a0dd5b

Please sign in to comment.