mirror of
https://github.com/langgenius/dify.git
synced 2026-05-06 10:28:10 +08:00
test: adding some web tests (#27792)
This commit is contained in:
@ -14,3 +14,39 @@ describe('makeProviderQuery', () => {
|
||||
expect(buildProviderQuery('ABC?DEF')).toBe('provider=ABC%3FDEF')
|
||||
})
|
||||
})
|
||||
|
||||
describe('Tools Utilities', () => {
|
||||
describe('buildProviderQuery', () => {
|
||||
it('should build query string with provider parameter', () => {
|
||||
const result = buildProviderQuery('openai')
|
||||
expect(result).toBe('provider=openai')
|
||||
})
|
||||
|
||||
it('should handle provider names with special characters', () => {
|
||||
const result = buildProviderQuery('provider-name')
|
||||
expect(result).toBe('provider=provider-name')
|
||||
})
|
||||
|
||||
it('should handle empty string', () => {
|
||||
const result = buildProviderQuery('')
|
||||
expect(result).toBe('provider=')
|
||||
})
|
||||
|
||||
it('should URL encode special characters', () => {
|
||||
const result = buildProviderQuery('provider name')
|
||||
expect(result).toBe('provider=provider+name')
|
||||
})
|
||||
|
||||
it('should handle Unicode characters', () => {
|
||||
const result = buildProviderQuery('提供者')
|
||||
expect(result).toContain('provider=')
|
||||
expect(decodeURIComponent(result)).toBe('provider=提供者')
|
||||
})
|
||||
|
||||
it('should handle provider names with slashes', () => {
|
||||
const result = buildProviderQuery('langgenius/openai/gpt-4')
|
||||
expect(result).toContain('provider=')
|
||||
expect(decodeURIComponent(result)).toBe('provider=langgenius/openai/gpt-4')
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user