mirror of
https://github.com/langgenius/dify.git
synced 2026-06-07 16:32:01 +08:00
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
26 lines
925 B
TypeScript
26 lines
925 B
TypeScript
import { describe, expect, it } from 'vitest'
|
|
import { ENV_REGISTRY } from '@/env/registry'
|
|
import { runHelpEnvironment } from './environment'
|
|
|
|
describe('runHelpEnvironment', () => {
|
|
it('starts with the ENVIRONMENT VARIABLES header', () => {
|
|
expect(runHelpEnvironment().startsWith('ENVIRONMENT VARIABLES\n\n')).toBe(true)
|
|
})
|
|
|
|
it('lists every var from ENV_REGISTRY with its description', () => {
|
|
const out = runHelpEnvironment()
|
|
for (const v of ENV_REGISTRY) {
|
|
expect(out).toContain(v.name)
|
|
expect(out).toContain(v.description)
|
|
}
|
|
})
|
|
|
|
it('marks sensitive vars with a never-echoed notice', () => {
|
|
const out = runHelpEnvironment()
|
|
expect(out).toContain('(treat as secret; never echoed)')
|
|
const sensitiveCount = ENV_REGISTRY.filter(v => v.sensitive).length
|
|
const noticeCount = (out.match(/treat as secret/g) ?? []).length
|
|
expect(noticeCount).toBe(sensitiveCount)
|
|
})
|
|
})
|