mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-07-12 13:52:15 +00:00
Bring apps/desktop and ui-tui to a clean state for typecheck, eslint,
and prettier:
- Run prettier across both trees (printWidth/wrap drift; prettier is not
CI-enforced for these JS projects, so main had accumulated drift).
- Apply eslint --fix for padding-line-between-statements and perfectionist
import/export sorting.
- Manual fixes for non-auto-fixable rules:
- remove unused node:net import in electron/main.cjs (uses Electron net)
- replace inline `typeof import(...)` annotations with top-level
`import type * as EnvModule` in two ui-tui test files
- scoped eslint-disable no-control-regex on intentional sentinel/ANSI
regexes (mathUnicode.ts, text.ts)
- resolve react-hooks/exhaustive-deps per-case: correct swapped/missing
deps, collapse redundant session.* members, and justified disables on
settings mount-only data-load effects to preserve run-once behavior
No behavior changes; test pass/fail counts are unchanged from the main
baseline.
48 lines
1.4 KiB
TypeScript
48 lines
1.4 KiB
TypeScript
import { beforeEach, describe, expect, it } from 'vitest'
|
|
|
|
import { modePref, skinPref } from './context'
|
|
import { DEFAULT_SKIN_NAME } from './presets'
|
|
|
|
// Skin and mode share one per-profile contract, so assert it once over both.
|
|
interface Pref {
|
|
resolve: (profile: string) => string
|
|
assign: (profile: string, value: string) => void
|
|
}
|
|
|
|
const cases = [
|
|
{
|
|
name: 'skin',
|
|
pref: skinPref as unknown as Pref,
|
|
fallback: DEFAULT_SKIN_NAME,
|
|
a: 'ember',
|
|
b: 'midnight',
|
|
junk: 'nope'
|
|
},
|
|
{ name: 'mode', pref: modePref as unknown as Pref, fallback: 'light', a: 'dark', b: 'system', junk: 'dusk' }
|
|
]
|
|
|
|
describe.each(cases)('per-profile $name', ({ pref, fallback, a, b, junk }) => {
|
|
beforeEach(() => window.localStorage.clear())
|
|
|
|
it('falls back to the default when unassigned', () => {
|
|
expect(pref.resolve('default')).toBe(fallback)
|
|
expect(pref.resolve('work')).toBe(fallback)
|
|
})
|
|
|
|
it('keeps each profile on its own value', () => {
|
|
pref.assign('work', a)
|
|
pref.assign('default', b)
|
|
expect(pref.resolve('work')).toBe(a)
|
|
expect(pref.resolve('default')).toBe(b)
|
|
})
|
|
|
|
it('lets unassigned profiles inherit the default profile as the global fallback', () => {
|
|
pref.assign('default', a)
|
|
expect(pref.resolve('never-themed')).toBe(a)
|
|
})
|
|
|
|
it('normalizes an unknown stored value back to the default', () => {
|
|
pref.assign('work', junk)
|
|
expect(pref.resolve('work')).toBe(fallback)
|
|
})
|
|
})
|