mirror of
https://github.com/langgenius/dify.git
synced 2026-06-23 20:41:17 +08:00
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
37 lines
1.4 KiB
TypeScript
37 lines
1.4 KiB
TypeScript
import { describe, expect, it } from 'vitest'
|
|
import { isCommandIndexPath, isExcludedCommandPath } from './command-fs'
|
|
|
|
describe('isExcludedCommandPath', () => {
|
|
it('excludes any path with an underscore-prefixed segment', () => {
|
|
expect(isExcludedCommandPath('auth/_shared/foo.ts')).toBe(true)
|
|
expect(isExcludedCommandPath('run/app/_strategies/index.ts')).toBe(true)
|
|
expect(isExcludedCommandPath('auth/devices/_shared/util.ts')).toBe(true)
|
|
expect(isExcludedCommandPath('_shared/index.ts')).toBe(true)
|
|
})
|
|
|
|
it('keeps regular paths', () => {
|
|
expect(isExcludedCommandPath('auth/login/index.ts')).toBe(false)
|
|
expect(isExcludedCommandPath('version/index.ts')).toBe(false)
|
|
})
|
|
|
|
it('normalizes backslashes', () => {
|
|
expect(isExcludedCommandPath('run\\app\\_strategies\\index.ts')).toBe(true)
|
|
})
|
|
})
|
|
|
|
describe('isCommandIndexPath', () => {
|
|
it('accepts paths that end with /index.ts and contain no excluded segments', () => {
|
|
expect(isCommandIndexPath('auth/login/index.ts')).toBe(true)
|
|
expect(isCommandIndexPath('version/index.ts')).toBe(true)
|
|
})
|
|
|
|
it('rejects non-index.ts files', () => {
|
|
expect(isCommandIndexPath('auth/login/util.ts')).toBe(false)
|
|
})
|
|
|
|
it('rejects excluded paths', () => {
|
|
expect(isCommandIndexPath('_shared/index.ts')).toBe(false)
|
|
expect(isCommandIndexPath('run/app/_strategies/index.ts')).toBe(false)
|
|
})
|
|
})
|