mirror of
https://github.com/langgenius/dify.git
synced 2026-04-27 22:18:15 +08:00
refactor(tests): reorganize test files and enhance test coverage for utility functions
- Moved test files for completion parameters, clipboard, app redirection, and emoji utilities to the appropriate directory structure. - Added comprehensive tests for clipboard functionality, including modern and legacy methods. - Implemented tests for app redirection logic based on user permissions and app modes. - Enhanced tests for completion parameters validation and error handling. - Introduced tests for emoji search functionality with various scenarios. - Updated icon utility tests to cover edge cases and security concerns. - Improved formatting tests for numbers, file sizes, and time representation.
This commit is contained in:
26
web/utils/__tests__/plugin-version-feature.spec.ts
Normal file
26
web/utils/__tests__/plugin-version-feature.spec.ts
Normal file
@ -0,0 +1,26 @@
|
||||
import { isSupportMCP } from '../plugin-version-feature'
|
||||
|
||||
describe('plugin-version-feature', () => {
|
||||
beforeEach(() => {
|
||||
vi.clearAllMocks()
|
||||
})
|
||||
|
||||
describe('isSupportMCP', () => {
|
||||
it('should call isEqualOrLaterThanVersion with the correct parameters', () => {
|
||||
expect(isSupportMCP('0.0.3')).toBe(true)
|
||||
expect(isSupportMCP('1.0.0')).toBe(true)
|
||||
})
|
||||
|
||||
it('should return true when version is equal to the supported MCP version', () => {
|
||||
const mockVersion = '0.0.2'
|
||||
const result = isSupportMCP(mockVersion)
|
||||
expect(result).toBe(true)
|
||||
})
|
||||
|
||||
it('should return false when version is less than the supported MCP version', () => {
|
||||
const mockVersion = '0.0.1'
|
||||
const result = isSupportMCP(mockVersion)
|
||||
expect(result).toBe(false)
|
||||
})
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user