Files
hermes-agent/ui-opentui/src/test/env.test.ts
T
alt-glitch ae11a636dc feat(tui): run on Node 26 (one runtime), finalize copy UX, rename to ui-opentui
Ports the engine off the second JS runtime onto Node 26.3 (node:ffi) so the
repo ships a single JavaScript runtime: child_process for the gateway, vitest
for tests, an esbuild + Solid build step. Mouse selection copies the rendered
text you highlight, and the clipboard path is crash-proofed (a broken copy
pipe no longer quits the UI). Renames the engine dir ui-tui-opentui-v2/ ->
ui-opentui/ and updates the launcher/installer/Docker references.
2026-06-09 16:16:48 +00:00

32 lines
1014 B
TypeScript

import { describe, expect, test } from 'vitest'
import { envFlag } from '../logic/env.ts'
describe('envFlag', () => {
test('recognizes truthy values regardless of case/whitespace', () => {
for (const v of ['1', 'true', 'yes', 'on', 'TRUE', 'Yes', ' on ']) {
expect(envFlag(v, false)).toBe(true)
}
})
test('recognizes falsy values regardless of case/whitespace', () => {
for (const v of ['0', 'false', 'no', 'off', 'FALSE', 'No', ' off ']) {
expect(envFlag(v, true)).toBe(false)
}
})
test('returns fallback when unset', () => {
expect(envFlag(undefined, true)).toBe(true)
expect(envFlag(undefined, false)).toBe(false)
expect(envFlag('', true)).toBe(true)
expect(envFlag(' ', false)).toBe(false)
})
test('returns fallback for unrecognized garbage', () => {
expect(envFlag('maybe', true)).toBe(true)
expect(envFlag('maybe', false)).toBe(false)
expect(envFlag('2', true)).toBe(true)
expect(envFlag('enabled', false)).toBe(false)
})
})