-
-
Notifications
You must be signed in to change notification settings - Fork 11.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add unit tests for menuKey function in ModelSwitchPanel module.
- Loading branch information
1 parent
c3cae6c
commit 4a0dd5b
Showing
1 changed file
with
22 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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('プロバイダー-モデル'); | ||
}); | ||
}); |